我有一个频率为 100 Hz 的波(它是一组数据)。我想绘制幅度和相位角与频率的关系。这就是我所做的,但我的幅度显示在错误的频率上,我错过了什么?
given x=[....] set of data representing wave of frequency = 100 Hz, of length 1500.
first: Nfft = 2^nextpow2(length(x));
second: Fs = 1000; (that is 10 times my frequency of 100, is that correct?)
third: get fft : xdft = fft(x,Nfft);
forth: get amplitude: amp = abs(xdft);
fifth: get phase : ang = unwrap(angle(xdft));
现在我的主要问题是正确设置频率向量,这就是我所做的
f_fold = Fs/2; % folding frequency = max frequency of FFT (Hz)
T = Nfft/Fs % total sample time (s)
del_f = 1/T; % (Hz)
f_v = [0:del_f:f_fold]'; % frequency (Hz)
我也尝试了matlab的建议:f_v = Fs*(0:Nfft-1)/Nfft
但是我的幅度总是以错误的频率显示。我能做些什么来解决这个问题?谢谢