资源描述:
《现代数字信号处理仿真作业》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、实用文案第三章仿真作业3.17(1)代码clear;N=32;m=[-N+1:N-1];noise=(randn(1,N)+j*randn(1,N))/sqrt(2);f1=0.15;f2=0.17;f3=0.26;SNR1=30;SNR2=30;SNR3=27;A1=10^(SNR1/20);A2=10^(SNR2/20);A3=10^(SNR3/20);signal1=A1*exp(j*2*pi*f1*(0:N-1));signal2=A2*exp(j*2*pi*f2*(0:N-1));signal3=A3*exp(j*2*pi*f3*(0:N-1));un=sign
2、al1+signal2+signal3+noise;uk=fft(un,2*N);sk=(1/N)*abs(uk).^2;r0=ifft(sk);r1=[r0(N+2:2*N),r0(1:N)];r=xcorr(un,N-1,'biased');figuresubplot(2,2,1)stem(m,real(r1));标准文档实用文案xlabel('m');ylabel('FFT估计r1实部');subplot(2,2,2)stem(m,imag(r1));xlabel('m');ylabel('FFT估计r1虚部');subplot(2,2,3)stem(m,real(
3、r));xlabel('m');ylabel('平均估计r实部');subplot(2,2,4)stem(m,imag(r));xlabel('m');ylabel('平均估计r虚部');仿真结果标准文档实用文案(2)代码clear;N=256;noise=(randn(1,N)+j*randn(1,N))/sqrt(2);f1=0.15;f2=0.17;f3=0.26;SNR1=30;SNR2=30;标准文档实用文案SNR3=27;A1=10^(SNR1/20);A2=10^(SNR2/20);A3=10^(SNR3/20);signal1=A1*exp(j*2*pi*
4、f1*(0:N-1));signal2=A2*exp(j*2*pi*f2*(0:N-1));signal3=A3*exp(j*2*pi*f3*(0:N-1));un=signal1+signal2+signal3+noise;NF=1024;spr=fftshift((1/NF)*abs(fft(un,NF)).^2);f1=(0:length(spr)-1)*(1/(length(spr)-1))-0.5;M=64;r=xcorr(un,M,'biased');bt=fftshift(abs(fft(r,NF)));f2=(0:length(bt)-1)*(1/(len
5、gth(bt)-1))-0.5;figuresubplot(1,2,1)plot(f1,10*log10(spr/max(spr)));xlabel('w/2pi');仿真结果标准文档实用文案(3)代码clear;N=1000;fai1=rand(1,1)*2*pi;fai2=rand(1,1)*2*pi;noise=(randn(1,N)+j*randn(1,N))/sqrt(2);un=exp(j*0.5*pi*(0:N-1)+j*fai1)+exp(-j*0.3*pi*(0:N-1)+j*fai2)+noise;p=8;cx=xcorr(un,p,'biased')
6、;rxx=cx(p+1:2*p)';R=toeplitz(rxx);[u,s]=eig(R);nw=128;ww=[-128:128]/128*pi;e=exp(-j*ww'*[0:p-1])%k行m列标准文档实用文案ev=e*u(:,1:p-2);pw=1./real(diag(ev*ev'));plot(ww/(2*pi),10*log10(pw)/max(pw));仿真结果3.20(1)代码clear;N=1000;fai1=rand(1,1)*2*pi;fai2=rand(1,1)*2*pi;noise=(randn(1,N)+j*randn(1,N))/sqrt
7、(2);un=exp(j*0.5*pi*(0:N-1)+j*fai1)+exp(-j*0.3*pi*(0:N-1)+j*fai2)+noise;p=8;标准文档实用文案cx=xcorr(un,p,'biased');rxx=cx(p+1:2*p)';R=toeplitz(rxx);[u,s]=eig(R);nw=128;ww=[-128:128]/128*pi;e=exp(-j*ww'*[0:p-1])%k行m列ev=e*u(:,1:p-2);pw=1./real(diag(ev*ev'));plot(ww/(2*pi),10