How to compute Fourier transform of a signal?

2 次查看(过去 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?

采纳的回答

Star Strider
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 个评论
Artem Smirnov
Artem Smirnov 2017-11-9
May I ask you, in this case, what will be on x and y axes? Is it Hz on x? And what should be on y? Thank you very much!
Star Strider
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 CenterFile Exchange 中查找有关 Array and Matrix Mathematics 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by