您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 质量控制/管理 > 实验2.1-随机过程的模拟与特征估计
实验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:Nx(n)=a*x(n-1)+w(n);endsubplot(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功率谱估计')gridonsubplot(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或1024w=randn(N,1);forn=1:Nx(n)=sin(2*pi*0.05*n)+2*cos(2*pi*0.12*n)+w(n);endsubplot(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')gridonsubplot(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或1024w=randn(N,1);forn=1:Nx(n)=sin(2*pi*0.05*n)+2*cos(2*pi*0.12*n)+w(n);endsubplot(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')gridonsubplot(3,2,6);pwelch(x,128,64,[],1000);axis([0500-5010]);title('韦尔奇功率谱估计/N=1024');gridon;
本文标题:实验2.1-随机过程的模拟与特征估计
链接地址:https://www.777doc.com/doc-7240316 .html