Two examples of frequency manipulation

Solution



The following script select the second spike (in magnitude order) in the left half of the FFT and computes the frequency:

L=length(powerSpect);
L1 = floor(L/2);
powerSpect2 = powerSpect(1:L1);
[sortSpect,iSpect]=sort(powerSpect2,'descend');
pitch = iSpect(2);
f=Fs/2*(linspace(0,1,L1));
disp(['pitch is at index ' num2str(pitch)]);
TempFreq=f(pitch)
TempPeriod=(1/TempFreq)/3600

which yields

pitch is at index 366

TempFreq =

1.1577e-05


TempPeriod =

23.9945

that is, we have a pseudo period of 24 hours. This is not really a period because the temperature is not day periodic, however the spike at a 24 hours period dominates the FFT of the temperature.