当数据集具有不同矢量长度时的 FFT
我有来自正在运行的模型的数据。然而,数据是在每个时间步收集的,并且时间步的数量不同。结果表明,尽管时间步长不同,但它可以通过时间步长的变化进行补偿,以便所有运行都在同一时间运行。
然而,我认为当我有一个长度为 200 的向量和一个长度为 900 的向量时,采用 FFT 会给出本质上不同的频率。我觉得我应该对所有样本的同一时间轴进行 FFT。
我现在获取数据的方式就像行向量一样,每个条目不与时间空间关联。
有没有办法获取每个向量相对于它们在时间轴中的位置而不是它们在向量数组中的位置的 fft ?
我的目标是编写一个 for 循环并获取许多数据集的 fft,然后绘制它们以比较频率特征变化。
I have data from a model I am running. However the data is collected at each time step and there are varying numbers of time steps. It works out that although there are varying time steps, it is compensated by the change in time step so that all runs are running for the same time.
However I would think that when I have a vector that is 200 in length and one that is 900 in length, taking the FFT will give me inherently different frequencies. I feel like I should take the FFT with respect to the same time axis of all the samples.
The way I have the data now is just as row vectors were each entry is not associated with a space in time.
Is there a way to take the fft of each vector with respect to their place in a time axis rather than their place in the vector array?
My goal is to write a for loop and take the fft of many data sets, and then plot them to compare of frequency signatures change.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您在 1 秒 (200 Hz) 内收集 200 个样本,则可以解析从 1 Hz(1/(1 秒))到 100 Hz 的输入数据。如果采样 1 秒收集 900 个样本,则可以解析从 1 Hz 到 450 Hz 的输入。因此,您的两个样本具有相同的间距(频率轴上的采样为 1 Hz),但它们的最大频率不同!
如果您的问题只是关于绘图,您可以丢弃所有绘图中不可用的高频:
...或者接受现实,并绘制您拥有的所有数据:
If you collect 200 samples in 1 second (200 Hz), you can resolve input data from 1 Hz (1/(1 sec)) to 100 Hz. If you sample for 1 second collecting 900 samples, you can resolve input from 1 Hz to 450 Hz. So both your samples have the same spacing (sampling in the frequency axis is 1 Hz), but they go up to different maximum frequencies!
If your issue is just about plotting, you can either throw away the high frequencies which are not available in all your plots:
... or live with reality, and plot all data you have:
您可以将数据(通过过滤插值)重新采样为恒定长度向量,其中每帧中的采样率都是相同的恒定速率。您可能还必须重叠 FFT 帧才能获得恒定的帧或窗口偏移。
You could resample your data (by filtered interpolation) into constant length vectors where the sample rate was the same constant rate in each frame. You may have to overlap your FFT frames as well to get constant frame or window offsets.