why is periodogram(y,w) not periodogram(y.*w)

why is periodogram(y,w) not the same as periodogram(y.*w), where y is the signal and w the window. For a rectangular window it is the same but for a hanning window there is a difference that has something to do with the mean and variance of the window I guess. What exactly is this difference? And why is this difference there? Same holds for pwelch.

 Réponse acceptée

Wayne King
Wayne King le 6 Fév 2014
Modifié(e) : Wayne King le 6 Fév 2014

0 votes

The difference is that the syntax periodogram(y,w) uses the window normalization constant explained here:
Read about the modified periodogram.
While periodogram(y.*w) does not use that normalization because you are using a rectangular window
I would recommend using
periodogram(y,w)
However, if you look at the two periodograms, you'll see that one is simply a scaled version of the other and that scaling is due to window normalization you get with
periodogram(y,w)

1 commentaire

Wesley Ooms
Wesley Ooms le 7 Fév 2014
Modifié(e) : Wesley Ooms le 7 Fév 2014
Thanks alot, That is a very good link
For other people who are interested: this is how to go from fft to periodogram (amplitude power spectrum) and from periodogram to pwelch:
y = load('data.mat') ;% samples
t = load('time.mat') ;% time
d = mean(diff(t)) ;% delta time
N = length(y) ;% number of samples
a = 10 ;% number of averages
o = 1000 ;% overlap
l = floor((N+o*(a-1))/a) ;% length of time vectors
w = (1-cos(2*pi*(1:l)/(l+1))) ;% window
f = ceil(-N/2:N/2-1)/d/N ;% frequency points
P = pwelch(y,w,o,l) ;% -----> pwelch <-----
n = floor(l/2)+1;p=eye(n,a);q=p ;% initialize variables
for k=1:a;
z = y((1:l)+(l-o)*(k-1)) ;
p(:,k) = periodogram(z,w,l) ;% -----> periodogram <-----
Y = fft(z'.*w) ;% -----> fft <-----
Y = [Y(1)/sqrt(2) Y(2:n-1) Y(n)/sqrt(2-rem(l,2))];
q(:,k) = Y.''.*Y/pi/(w*w') ;
end
p = mean(p,2); q = mean(q,2) ;% average
figure(1);clf ;% post processing
subplot(311); plot(y);
subplot(312); plot(P);hold all;plot(p);plot(q)
subplot(313); plot(abs(P)-abs(q))
linkaxes(get(figure(1),'children'),'x')

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Get Started with Signal Processing Toolbox dans Centre d'aide et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by