FFT of Unsteady Temperature Data Resulting a Peak at 0 Hz
Ältere Kommentare anzeigen
Hi all,
I have a data that was sampled at 50 Hz for 120 seconds. When I apply fft, dominant frequency seems to be 0 Hz which I initially thought it could actually very well be. However, when I apply same fft to different set of data acquired from the experiment, I get the same peak at 0 Hz, which does not seem to be correct as I expect it to show relatively high frequency(ies) ( this is due to nature of experiment in which the unsteady temperature data is acquired, and the second set of data is expected to show some form of periodicity).
As you may see below in the code, DC offset is removed by "detrend" and a low pass filter is applied ( the result was the same even before low pass filtering).
Can you please take a look at the code (data is attached as well) for any possible corrections or recommendations? If everything is okay with the code, I will appreciate some comments on the physical meaning of the frequency analysis result in this particular case.
Best.

Fs = 100; % Sampling frequency
T = 1/Fs; % Sampling period
dt = 0 :T:120-T; % Time vector
nfft= length(S2TR3_0); %Length of FFT
nfft2 = 2.^nextpow2(nfft) ;
S2TR3_0 = detrend(S2TR3_0);
figure
plot(S2TR3_0)
fy = fft(S2TR3_0,nfft2);
fy = fy(1:nfft2/2);
xfft = Fs.*(0:nfft2/2-1)/nfft2;
plot(xfft,abs(fy/max(fy)));
%low pass filter
cut_off = 2/Fs/2;
order = 256;
h = fir1(order,cut_off);
con = conv(S2TR3_0,h);
figure
plot(con);
fh = fft(h,nfft2);
fh = fh(1:nfft2/2);
fh = fh';
mul = fh.*fy;
figure
plot(abs(mul));
3 Kommentare
David Goodmanson
am 25 Apr. 2020
Hi Oguzhan,
Your 50 Hz comment and the Fs = 100 in the code do not agree. I went with 100, so 100 Hz sampling for 60 sec but the basic conclusion is the same whichever one is used. Either way the result looks ok. I did the transform slightly differently, not using nexpow2, and saw very similar results. A lot of frequency content in the region of 0.1 Hz, which makes sense because that's 6 oscilllations in the time window and you can see a lot of that kind of thing, and slower, going on.
I'm not a fan of nextpow2 and I think it's not useful the vast majority of the time, but it looks to have done all right in this situation.
Oguzhan M
am 25 Apr. 2020
Daniel M
am 25 Apr. 2020
No, sampling rate is the same as Fs. You are thinking of Nyquist rate, which is half of Fs, and is typically used for filtering (as you did with cut_off = 2 / (Fs/2) ).
For the second comment, he is saying that he can visually identify an underlying 0.1 Hz oscillation in the time-domain data. 0.1 Hz means one oscillation every 10 seconds.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Transforms finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!