Harmonic analysis of time series
조회 수: 1 (최근 30일)
이전 댓글 표시
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](https://www.mathworks.com/matlabcentral/answers/uploaded_files/237450/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
댓글 수: 0
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!