Power spectrum and periodicity

조회 수: 3 (최근 30일)
Kavita Navria
Kavita Navria 2022년 1월 31일
답변: Star Strider 2022년 1월 31일
I have a data of length 336 (336 days) having a frequency of an event.
  1. 3
  2. 1
  3. 0
  4. 0
  5. 2
  6. so on to 336
how can I plot power spectrum and periodicity of this data?
thank you

채택된 답변

Star Strider
Star Strider 2022년 1월 31일
There are a number of functions in the Spectral Estimation section of the Signal Processing Toolbox documentation that will work.
For a simpler approach, since power is the square of amplitude, do a Fourier transform (fft) on the element-wise square of the original signal:
M = [(1:365).' rand(365,1)]; % Original Data
L = size(M,1);
Ts = M(2,1) - M(1,1); % Sampling Interval
Fs = 1/Ts; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
s = M(:,2); % Signal Vector
NFFT = 2^nextpow2(L); % For Efficiency
FTs2 = fft(s.^2,NFFT)/L; % Fourier Transform
Fv = linspace(0, 1, NFFT/2+1)*Fn; % Frequency Vector
Iv = 1:numel(Fv); % Inmdex Vector
figure
plot(Fv, abs(FTs2(Iv)))
grid
xlabel('Frequency (Cycles/Day)')
ylabel('Amplitude')
.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by