Effacer les filtres
Effacer les filtres

Harmonic analysis of time series

1 vue (au cours des 30 derniers jours)
edward kabanyas
edward kabanyas le 8 Sep 2019
Hi all,
I want to make harmonic analysis for my time series data to see first (diurnal) and second harmonic (semi diurnal variation). I simply tried the following code:
xxx = 0:1:23;
asc = Hour';
dec = xxx';
%FFT
d = fft(dec);
m = length(dec);
M = 3;
a0 = d(1)/m;
an = 2*real(d(2:M))/m;
bn = -2*imag(d(2:M))/m;
n = 1:length(an);
y1 = a0 + 0*cos(2*pi*1*x/23)+0*sin(2*pi*1*x/23);
y2 = a0 + an(1)*cos(2*pi*n(1)*x/23)+bn(1)*sin(2*pi*n(1)*x/23);
y3 = a0 + an(2)*cos(2*pi*n(2)*x/23)+bn(2)*sin(2*pi*n(2)*x/23);
y4 = a0 + an*cos(2*pi*n'*x/23) ...
+ bn*sin(2*pi*n'*x/23);
It seems ok, howewer in Statistical Methods in the Atmospheric Sciences book, the author use another method:
harmonic_equ.png
I want to make harmonic analysis using this equation and compare with the above code. Are there any body having experience with this question in Matlab?
Thank you for sharing.
Edward

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by