How to compute Fourier transform of a signal?
3 ビュー (過去 30 日間)
古いコメントを表示
Hello! I have three arrays of data (see the picture). There is 1 measurement every day for 11 years. I know that for fft I need to define sampling frequency, then the time step, signal duration and then count the fft. That is what everyone says about fft on the example of harmonic functions. But in case I have 11*365 measurements, how to find the Fourier transform of this? I attach the picture with my code and the picture with the abs(ft). Why do I get things like that when the signal surely has quasi-harmonic component? Could you please help me to correct this?



0 件のコメント
採用された回答
Star Strider
2017 年 11 月 9 日
The problem is that the constant offset value of your signal is very high compared to the amplitude of the oscillations. I would remove the constant offset (the mean of your data) before calculating the Fourier transform. That will show the oscillations much more clearly.
Example —
n = length(H);
Ts = 1; % Sampling Interval (day)
Fs = 1/Fs; % Sampling Frequency (samples/day)
Fn = Fs/2; % Nyquist Frequency
nfft = 2^nextpow2(n);
Hn = H-mean(H); % Remove Constant Offset
ft = fft(Hn,nfft)/n;
Fv = linspace(0, 1, fix(n/2)+1)*Fn; % Frequency Vector
Iv = 1:length(Fv); % Index Vector
figure(1)
plot(Fv, abs(ft(Iv))*2)
grid
I also provide the frequency vector for your data, and plotted it with respect to that.
NOTE — I do not have your data, so this is UNTESTED CODE. It should work.
2 件のコメント
Star Strider
2017 年 11 月 9 日
The frequency units will be in cycles/day. If you want them in Hz, divide ‘Fv’ by (24*60*60) (the number of seconds in a day). The rest of the code does not change, although the x-axis units could become difficult to read and interpret.
The amplitude units will be the same as the original amplitude units.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Array and Matrix Mathematics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!