how can i apple fourier analyiss on vector of 736 temperature readings?

1 view (last 30 days)
I have a vector of 736 temperature readings, one for every 3rd hour between jun-aug, therefore 8 per day for jun-aug.
I need to apply a Fourier analysis to this vector. I have normalized it. I have searched all over (because I really don't understand matlab) and all I see are these analysis with signs where you already have a sampling to compare it to (like 1000Hz keeps coming up). the sampling interval is 3hrs and the length of sampling is 90 days. I don't know how to do this. any help would REALLY help.
I have tried fft(x) vs abs(fft(x) but now I am bout told I have to plot amplitude vs frequency where I am assuming abs(fft(x)) is amp but freq I am not sure
Thank you for your time I appreciate it

Answers (2)

Image Analyst
Image Analyst on 3 Nov 2013
Not sure what the problem is. You don't change the sampling rate. it is what it is. Just call fft().
ft = fft(temperatures);
If it's a real signal, which it is, then your ft will be hermitian (even real part and odd imaginary part). You can plot either the real part with plot(real(ft)), the imaginary part with plot(imag(ft)), or the magnitude with plot(abs(ft)). You might want to take the log of them before you plot them so that you can see the signal better, or else you might want to subtract off the mean of your signal so that you don't have a huge DC spike. Some tutorials:

Wayne King
Wayne King on 3 Nov 2013
Image Analyst has given you some good advice.
Since your sampling frequency is 8 samples/day, your frequency vector will run from -4 cycles/day to 4 cycles/day (1 cycle per every 6 hours). Of course, if the data is real-valued (as it is here), then you only need to plot the magnitude from 0 cycles/day to 4 cycles/day.
I'll simulate an example:
Fs = 8; % 8 cycles/day
t= 0:1/Fs:(736*1/Fs)-1/Fs;
x = cos(2*pi*2*t)+randn(size(t)); % one sinewave at 2 cycles/day
xdft = fft(x); %obtain DFT
xdft = xdft(1:length(x)/2+1); % just keep "positive" frequencies
df = Fs/length(x); % frequency step
freqvec = 0:df:4; % frequency vector
plot(freqvec,abs(xdft))
xlabel('Cycles/Day'); ylabel('Magnitude');
If you have the Signal Processing Toolbox, you can obtain a power spectral density estimate easily (with an appropriate frequency vector) using periodogram.

Community Treasure Hunt

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

Start Hunting!