フィルターのクリア

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

1 回表示 (過去 30 日間)
Wesley Ooms
Wesley Ooms 2014 年 2 月 6 日
編集済み: Wesley Ooms 2014 年 2 月 7 日
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.

採用された回答

Wayne King
Wayne King 2014 年 2 月 6 日
編集済み: Wayne King 2014 年 2 月 6 日
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 件のコメント
Wesley Ooms
Wesley Ooms 2014 年 2 月 7 日
編集済み: Wesley Ooms 2014 年 2 月 7 日
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')

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSpectral Estimation についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by