%Matlab distributed data for temperatures sampled every 30 minutes for
%about 16.5 weeks.
load officetemp.mat
Fs = 1/(60*30); % Sample rate is 1 sample every 30 minutes
t = (0:length(temp)-1)/Fs; %Time vector
%Plot temperature
helperFrequencyAnalysisPlot2(t/(60*60*24*7),temp,...
'Time in weeks','Temperature (Fahrenheit)')
% Number of FFT points = sample size
NFFT = length(temp);
TEMP = fft(temp,NFFT);
TEMP(1) = 0; % remove the DC component for better visualization
% Frequency vector (only half of the frequencies need as FFT is symmetric)
F = (0 : 1/NFFT : 1/2-1/NFFT)*Fs;
helperFrequencyAnalysisPlot2(F*60*60*24*7,abs(TEMP(1:NFFT/2)),...
'Frequency (cycles/week)','Magnitude',[],[],[0 10])