Need help with periodogram

I am trying to turn this plot into a periodogram and I am not sure where to start... From frequencies 0.4Hz to 5 Hz Code:
clear,clc
load('DATA_01_TYPE01.mat')
A = sig;
x = A(2,1:1000)
t=1:1:1000;
subplot(3,1,1)
plot(t,x)

댓글 수: 7

Star Strider
Star Strider 2018년 10월 26일
If you want to know how to calculate it, see the More About (link) secton of the periodogram function.
Otherwise, just use the function itself.
G
G 2018년 10월 26일
How do I use the function itself for this type of example? This is what I am doing and I am not getting a correct plot. This is my code:
clear,clc
load('DATA_01_TYPE01.mat')
A = sig;
x = A(2,1:1000);
t=1:1:1000;
[pxx,w]=periodogram(x,[],[0.4 5]);
plot(w,10*log(pxx))
xlabel('Frequency (Hz)')
This is what I want mine to look like:
load sunspot.dat
relNums=sunspot(:,2);
[pxx,f] = periodogram(relNums,[],[],1);
plot(f,10*log10(pxx))
xlabel('Cycles/Year')
ylabel('dB / (Cycles/Year)')
title('Periodogram of Relative Sunspot Number Data')
Star Strider
Star Strider 2018년 10월 26일
Please read the documentation.
The third argument is the length of the Fourier transform. Neither the periodogram function nor I know what you intend with ‘[0.4 5]’ for that argument.
G
G 2018년 10월 26일
That is the range of the x axis that I want it to be
Star Strider
Star Strider 2018년 10월 26일
Use the xlim property of plot to define the specific frequency range to display (assuming that the frequency is your x-axis).
G
G 2018년 10월 26일
Yes. Then how do I plot my x values on the y axis for the periodogram plot
G
G 2018년 10월 26일
Right now it is just a diagonal line
clear,clc
load('DATA_01_TYPE01.mat')
A = sig;
x = A(2,1:1000);
[pxx,w]=periodogram(x,[],[0.4 5]);
plot(w,10*log(pxx))
xlim([0.4 5]);
xlabel('Frequency (Hz)')
title('Spectrum by Periodogram')

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Parametric Spectral Estimation에 대해 자세히 알아보기

태그

질문:

G
G
2018년 10월 26일

댓글:

G
G
2018년 10월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by