f] = periodogram(x,window,nfft,fs)这个语句的意思!

问题描述:

f] = periodogram(x,window,nfft,fs)这个语句的意思!
我看一段程序里头有这句[Pxx,f] = periodogram(x,window,nfft,fs),查了help,但是刚接触matlab,看了半天也没太看懂具体怎么个意思,哪位能帮忙解释解释这个periodogram到底怎么用啊?
help里头是这么说的[Pxx,f] = periodogram(x,window,nfft,fs) uses the sampling frequency fs specified as an integer in hertz (Hz) to compute the PSD vector (Pxx) and the corresponding vector of frequencies (f).In this case,the units for the frequency vector are in Hz.The spectral density produced is calculated in units of power per Hz.If you specify fs as the empty vector [],the sampling frequency defaults to 1 Hz.
1个回答 分类:综合 2014-11-24

问题解答:

我来补答
periodogram是用来计算功率谱密度的,参数中,
X:所求功率谱密度的信号;
window:所使用的窗口,默认是boxcar,其长度必须与x的长度一致;
nfft:采样点数;
fs:采样频率.
例如:
Fs=1000;
n=0:1/Fs:1;
x=cos(2*pi*40*n)+3*cos(2*pi*100*n)+randn(size(n));
nfft=1024;
window=boxcar(length(n));
[Pxx,f]=periodogram(x,window,nfft,Fs);
P=10*log10(Pxx);
plot(f,P);
hold on;
Pxx_1=abs(fft(x,nfft)).^2/length(n);
t=0:round(nfft/2-1);
f=t*Fs/nfft;
P_1=10*log10(Pxx_1(t+1));
plot(f,P_1,'r');
legend('periodogram','公式');
title('周期图法功率谱估计');
结果如下:
 
 
展开全文阅读
剩余:2000
下一页:铜,及其化合物