【问题标题】:Given an array of data, extract possible frequencies with fft, how to?给定一组数据,用 fft 提取可能的频率,如何?
【发布时间】:2012-10-18 17:25:10
【问题描述】:

我对振动和使用 matalb fft 相当陌生。我得到了一组长度为 15000 的数据(一维数组)(不确定这是否相关),我试图弄清楚是否有任何波埋在这个数据。我被指示可能使用 matlab fft。这是正确的方法吗?我期待看到什么?我真的不确定如何解释我会得到的任何结果。 请让我知道你们的想法。 谢谢,如果需要更多详细信息,我会提供。 示例:

% Df=[array is given to me and it is of size 15000];
% t=[time used for the above array, and if it is of the same size, also provided to me]


N_0= length(t);

fs_0=length(Dfxz);

Y_0=fft(Dfxz,N_0);

k_0=-N_0/2:N_0/2-1;

%Find the phase angle
p_0 = (angle(Y_0));
R_0 = norm(Y_0);

ff_0 = (0:length(Y_0)-1)'/length(Y_0)*100;    % Frequency vector
FT_power1_0 = abs(Y_0);

plot(k_0*fs_0/N_0,fftshift(abs(Y_0)))

我只看到频率 = 0 的 1 次窥视,但我确信有非零频率,我做错了什么? 谢谢! PS:我也不知道如何选择采样频率?请提供任何提示(请记住,我不知道原始频率)

【问题讨论】:

  • 请告诉我们您尝试了什么?
  • 您可以使用 FFT 计算离散傅立叶变换,但在不了解您的数据(尤其是采样频率)的情况下,这与物理意义上的频率没有任何关系。
  • 如果您不知道数据的采样频率,您将无法得到有意义的答案“埋在信号中的正弦曲线的频率是多少”。您只能定性地判断(通过查看周期图中是否存在峰值)您的信号在观察期间是否表现出振荡行为。如果您在解释结果时遇到问题,我建议您发帖到dsp.stackexchange.com,因为这与编程无关。 BTW:采样频率是由't'中的时间点给你的......

标签: matlab fft frequency-analysis


【解决方案1】:

试试我的版本。在我看来,您拥有在数据中找到频率峰值(如果存在)所需的所有信息。如果您所看到的只是零频率的一个大峰值,那么您可能有一个巨大的 DC 偏移量,它淹没了所有其他数据。我在我的代码中加入了补救措施。 .

x = randn(15000,1); %//This is the data you were given - I'll use noise for demonstration - replace x with your Df data

%//If youre getting a massive peak at zero that dwarfs everything else, you
%//probably have a large DC offset. Easily removed in the time domain using
%//the following ..
x = x-mean(x);

tAxis = linspace(3/15000,3,15000); %//You said you have this too - I'll make up something for demonstration - make sure you replace this with your t data
dt = diff(tAxis(1:2)); %//sample period from time axis
fs = 1/dt;%//sample rate from sample period

NFFT = numel(x); %//number of fft bins - change if you like
Y = abs(fft(x, NFFT)).^2; %power spectrum

%//Calculate frequency axis
df = fs/NFFT;
fAxis = 0:df:(fs-df);

%//Plot it all
figure; plot(fAxis(1:NFFT/2), Y(1:NFFT/2))
xlabel('Frequency in Hz')
ylabel('Power')

如果一切正常,您可以通过查看another FFT answer on stackoverflow 来更深入地了解。

【讨论】:

  • 谢谢,我试试看:)
  • @AmaniLama 你知道你接受答案会获得积分吗:)?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-05-12
  • 2013-01-13
  • 1970-01-01
  • 2013-04-01
  • 1970-01-01
  • 2013-08-24
  • 1970-01-01
相关资源
最近更新 更多