frequency axis to time axis in power spectral density
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi all
I have 120 data points for 120 days. and plotted power spectrum as shown in code.. now my doubt is that how to convert frequency axis to time period axis. i defined frequency as
T = number of days (120); f = (0:N/2-1)/T;
then I have plotted power spectrum with frequency axis
then I want to plot power spectrum with time axis..
Now my doubt is period = 1./f; or period = f.*T; ......???? which one is correct.. I was trying to solve this from many days.. some of my friends are telling first is right. some are telling second is right. I am completely lost. somebody help me out..
Thanks in advance
u = xlsread('sample.xlsx');
N= length(u); % number of data points
T = N;
f = (0:N/2-1)/T; per = f.*T; period = 1./f;
p_sur_cur= abs(fft(u)/2+1)/(N); % absolute value of the FFT
pow_sur = p_sur_cur(1:(N/2)).^2; % take the power of positive freq half
plot(f,pow_sur,'color','r')
figure
plot(period,pow_sur)
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Oceanography and Hydrology에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!