实验2.1-随机过程的模拟与特征估计.doc
《实验2.1-随机过程的模拟与特征估计.doc》由会员分享,可在线阅读,更多相关《实验2.1-随机过程的模拟与特征估计.doc(4页珍藏版)》请在冰点文库上搜索。
实验2.1随机过程的模拟与特征估计
实验结果及分析:
实验2.1
(1)估计x(n)=0.8*x(n-1)+1+4.*randn(N,1)随机序列的自相关函数和功率谱
MATLAB仿真程序
%估计x(n)=0.8*x(n-1)+1+4.*randn(N,1)随机序列的自相关函数和功率谱
%x(n)=0.8*x(n-1)+1+4.*randn(N,1)随机序列的产生
a=0.8;
N=500;
w=1+2.*randn(N,1);
x
(1)=w
(1);
forn=2:
N
x(n)=a*x(n-1)+w(n);
end
subplot(3,2,1);
plot(x);
title('随机序列x(n)=0.8*x(n-1)+1+4.*randn(N,1)');
gridon
%估计自相关函数
R=xcorr(x,'coeff');
subplot(3,2,2);
axis([050001]);
plot(R);
title('自相关函数');
gridon
%估计功率谱
%周期图功率谱估计
subplot(3,2,3);
periodogram(x,[],512,1000);
axis([0500-500]);
title('周期图功率谱估计')
%加汉宁窗
window=hann(500);
subplot(3,2,4);
periodogram(x,window,512,1000);
axis([0500-5010]);
title('汉宁周期功率谱估计')
%相关函数法
R=xcorr(x)/15000;
Pw=fft(R);
subplot(3,2,5);
f=(0:
length(Pw)-1)*1000/length(Pw);
plot(f,10*log10(abs(Pw)));
axis([0500-5010]);
title('BT功率谱估计')
gridon
subplot(3,2,6);
pwelch(x,128,64,[],1000);
axis([0500-5010]);
title('韦尔奇功率谱估计');
gridon;
实验2.1
(2)x=sin(2*pi*0.05*n)+2*cos(2*pi*0.12*n)+randn(N,1)随机序列的自相关函数和功率谱
N=256时的结果:
N=1024时的结果:
MATLAB仿真程序
N=256:
%估计x=sin(2*pi*0.05*n)+2*cos(2*pi*0.12*n)+randn(N,1)随机序列的自相关函数和功率谱
%x=sin(2*pi*0.05*n)+2*cos(2*pi*0.12*n)+randn(N,1)随机序列的产生
N=256;%N=256或1024
w=randn(N,1);
forn=1:
N
x(n)=sin(2*pi*0.05*n)+2*cos(2*pi*0.12*n)+w(n);
end
subplot(3,2,1);
plot(x);
axis([0260-88]);
title('随机序列x(N)=sin(2*pi*0.05*n)+2*cos(2*pi*0.12*n)+randn(N,1)/N=256');
gridon
%估计自相关函数
R=xcorr(x,'coeff');
subplot(3,2,2);
plot(R);
axis([0500-11]);
title('自相关函数/N=256');
gridon
%估计功率谱
%周期图功率谱估计
subplot(3,2,3);
periodogram(x,[],512,1000);
axis([0500-500]);
title('周期图功率谱估计/N=256')
%加汉宁窗
window=hann(256);
subplot(3,2,4);
periodogram(x,window,256,1000);
axis([0500-5010]);
title('汉宁周期功率谱估计')
%相关函数法
R=xcorr(x)/15000;
Pw=fft(R);
subplot(3,2,5);
f=(0:
length(Pw)-1)*1000/length(Pw);
plot(f,10*log10(abs(Pw)));
axis([0500-5010]);
title('BT功率谱估计/N=256')
gridon
subplot(3,2,6);
pwelch(x,128,64,[],1000);
axis([0500-5010]);
title('韦尔奇功率谱估计/N=256');
gridon;
N=1024:
%估计x=sin(2*pi*0.05*n)+2*cos(2*pi*0.12*n)+randn(N,1)随机序列的自相关函数和功率谱
%x=sin(2*pi*0.05*n)+2*cos(2*pi*0.12*n)+randn(N,1)随机序列的产生
N=1024;%N=256或1024
w=randn(N,1);
forn=1:
N
x(n)=sin(2*pi*0.05*n)+2*cos(2*pi*0.12*n)+w(n);
end
subplot(3,2,1);
plot(x);
axis([01030-88]);
title('随机序列x(N)=sin(2*pi*0.05*n)+2*cos(2*pi*0.12*n)+randn(N,1)/N=1024');
gridon
%估计自相关函数
R=xcorr(x,'coeff');
subplot(3,2,2);
plot(R);
axis([02000-11]);
title('自相关函数/N=1024');
gridon
%估计功率谱
%周期图功率谱估计
subplot(3,2,3);
periodogram(x,[],1024,1000);
axis([0500-500]);
title('周期图功率谱估计/N=1024')
%加汉宁窗
window=hann(1024);
subplot(3,2,4);
periodogram(x,window,1024,1000);
axis([0500-5010]);
title('汉宁周期功率谱估计')
%相关函数法
R=xcorr(x)/15000;
Pw=fft(R);
subplot(3,2,5);
f=(0:
length(Pw)-1)*1000/length(Pw);
plot(f,10*log10(abs(Pw)));
axis([0500-5010]);
title('BT功率谱估计/N=1024')
gridon
subplot(3,2,6);
pwelch(x,128,64,[],1000);
axis([0500-5010]);
title('韦尔奇功率谱估计/N=1024');
gridon;