Why does periodogram varies with data length?

조회 수: 6 (최근 30일)
Vinicius
Vinicius 2013년 10월 14일
답변: Vinicius 2013년 10월 14일
Hello,
I'm trying to understand better how periodogram works by using it with pure sinusoids.
Fs = 1000;
t = 0:1/Fs:1-1/Fs;
x = sin(2*pi*100*t);
[psdestx,Fxx] = periodogram(x,[],length(x),Fs);
plot(Fxx,psdestx); grid on;
xlabel('Hz');
title('Periodogram Power Spectral Density Estimate');
I took most of the above code from a MATLAB example in the documentation center: http://www.mathworks.com/help/signal/ug/psd-estimate-using-fft.html
The response, 0.5 peak at 100 Hz, seems correct to me, since the theoretical average power of a sinusoid is (A^2)/2. It's also the same answer I get when I type:
mean(x.^2)
My doubt arises when I increase data length, from the code's second line:
t = 0:1/Fs:2-1/Fs;
Why does this change my PSD estimate? Since I'm dealing with a periodic signal, shouldn't the average power remains constant, despite data length?
Thank you, Vinícius

채택된 답변

Wayne King
Wayne King 2013년 10월 14일
편집: Wayne King 2013년 10월 14일
Because the periodogram is strictly a PSD estimate unless you specify the 'power' option. By doubling the time interval you are integrating over twice the interval.
If you specify the 'power' option, you'll get what you expect 0.5
Fs = 1000;
t = 0:1/Fs:2-1/Fs;
x = sin(2*pi*100*t);
[psdestx,Fxx] = periodogram(x,[],length(x),Fs,'power');
plot(Fxx,psdestx); grid on;
xlabel('Hz');
title('Periodogram Power Estimate');

추가 답변 (3개)

Vinicius
Vinicius 2013년 10월 14일
Thanks for the reply Wayne.
The 'power' option doesn't work in my version of MATLAB (2012a), but I could replace it by 'ms'. Do you know if it's the same thing? I can't see it described in any documentation.
Also, could you clarify the meaning of the values I see in the plot with default options? For example, let's say I see a peak of 0.5 at 100 Hz and a peak of 2 at 200 Hz, in a otherwise "clean" periodogram. I thought this would mean that, to reconstruct the original signal, I would need two sinusoids, with 100 and 200 Hz frequency, each with average power of 0.5 and 2, respectively (plus phase adjustment). Is that not correct?
Finally, is the plot with default options more meaningful, or more used? And why?

Wayne King
Wayne King 2013년 10월 14일
In R2012a, you can use spectrum.periodogram and then msspectrum
Fs = 1000;
t = 0:1/Fs:2-1/Fs;
x = 0.5*cos(2*pi*100*t)+2*sin(2*pi*200*t);
hper = spectrum.periodogram;
hper.Windowname = 'Flat top';
hms = msspectrum(hper,x,'Fs',Fs);
plot(hms.Frequencies,hms.Data)
Looking at the plot (this is a one-sided power spectrum), the intepretation is this, the power at 100 Hz is 0.125 so you have a cosine (ignoring phase) with an amplitude of
sqrt(2*0.125)
The power estimate at 200 Hz is 2 so you have a sinusoid with an amplitude of
sqrt(2*2)

Vinicius
Vinicius 2013년 10월 14일
Great, this was exactly my understanding!
I just still don't get what the plot with the default option means. And why is that even the default? This second option seems much more logical and easy to interpret.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by