I calculate the Fourier transform and the Lomb Periodogram of data which contain NaNs. The signal is sampled regularly at a rate of 96 per day, see attached .mat file. Missing data ('NaN') are set to zero before calculating the FFT. (Alternatively, I have removed the NaNs by interpolation of adjacent non-NaNs, which resulted in essentially the same Fourier frequencies).
Based on the Fourier transform, 1/day is the dominant frequency. The Lomb periodogram indcates a dominant frequency of 2/day. What is the cause of this disagreement?
%%Lomb Periodogram
Fs = 96; % Sampling frequency (per day)
T = 1/Fs; % Sampling period
L = 96*212; % Total number of time steps
t = (0:L-1)*T; % Time vector (in units of days)
[Plomb,flomb] = plomb(yy,t*60*60*24,4e-4,'power');figuresubplot(2,1,1)plot(flomb*60*60*24,Plomb); grid ontitle('Lomb Periodogram of yy(t)')xlabel('Frequency (per day)')ylabel('Power (dBW)')xlim([-1,10])%%Fourier transform
yy(isnan(yy))=0; % Setting NaNs to zero
Y = fft(yy); % FFT
P2 = abs(Y/L);P1 = P2(1:L/2+1); P1(2:end-1) = 2*P1(2:end-1); %single-sided spectrum
f = Fs*(0:(L/2))/L; subplot(2,1,2)plot(f,P1); grid ontitle('Single-Sided Amplitude Spectrum of yy(t)')xlabel('f (per day)')ylabel('|Amplitude|')xlim([-1,10])
Best Answer