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

1 view (last 30 days)
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.

Accepted Answer

Wayne King
Wayne King on 6 Feb 2014
Edited: Wayne King on 6 Feb 2014
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 Comment
Wesley Ooms
Wesley Ooms on 7 Feb 2014
Edited: Wesley Ooms on 7 Feb 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')

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!