index_siggai.asv

来自「主要是BURG法对声信号进行谱估计的程序。 还有利用BURG法求AR模型系数」· ASV 代码 · 共 36 行

ASV
36
字号
clear
N=500;
n=0:1/Fs:1;
fs=100;f1=35;f2=40;
w1=2*pi*f1/fs;
w2=2*pi*f2/fs;
A1=5;
A2=12;
for nn=1:N
    xn(nn)=A1*exp(j*w1*n(nn))+A2*exp(j*w2*n(nn))+0.1*rands(1);
end
%xn=A1*(cos(w1*n)+j*sin(w1*n))+A2*(j*sin(w2*n)+cos(w2*n))+randn(size(n));%xn=A1*exp(jw1n)+A2*exp(jw2n);
subplot(211);
plot(n,xn);
xlabel('n');
ylabel('xn');
title('xn=A1*exp(jw1n)+A2*exp(jw2n)+e(n)');
ymax_xn=max(xn)+0.2;
ymin_xn=min(xn)-0.2;
axis([0 0.5 ymin_xn ymax_xn]);
p=floor(length(xn)/5);
nfft=1024;
[xpsd,f]=pburg(xn,p,nfft,Fs);
pmax=max(xpsd);
xpsd=xpsd/pmax;
xpsd=10*log10(xpsd);
subplot(212);
plot(f,xpsd);
title('Power Spectral estimate with burg');
ylabel('Power Spectral estimate(dB)');
xlabel('f(Hz)');
grid on;
ymin_psd=min(xpsd)-1;
ymax_psd=max(xpsd)+1;
axis([0 Fs/2 ymin_psd ymax_psd]);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?