收藏 分销(赏)

数字信号处理实验报告实验一.doc

上传人:仙人****88 文档编号:9283426 上传时间:2025-03-19 格式:DOC 页数:8 大小:203.04KB 下载积分:10 金币
下载 相关 举报
数字信号处理实验报告实验一.doc_第1页
第1页 / 共8页
数字信号处理实验报告实验一.doc_第2页
第2页 / 共8页


点击查看更多>>
资源描述
数字信号处理实验报告实验一 2-1. R=50; m=0:R-1; s=2*m.*(0.9.^m); d=rand(R,1)-0.5; x=s+d'; x1=0; for n=1:R; d=rand(R,1)-0.5; x=s+d'; x1=x1+x; end x1=x1/R; subplot(2,2,1),stem(m,s),xlabel('Time index n');ylabel('Amplitude');title('Original uncorrupted data') subplot(2,2,2),stem(m,d),xlabel('Time index n');ylabel('Amplitude');title('Noise') subplot(2,2,3),stem(m,x),xlabel('Time index n');ylabel('Amplitude');title('Noise corrupted sequense') subplot(2,2,4),stem(m,x1),xlabel('Time index n');ylabel('Amplitude');title('Ensemble average') 2-2-1. a=input('Type in real exponent ='); b=input('Type in imaginary exponent ='); c=a+b*i; K=input('Type in the gain constant ='); N=input('Type in length of sequence ='); n=1:N; x=K*exp(c*n); stem(n,real(x)); xlabel('Time index n');ylabel('Amplitude');title('Real part'); disp('PRESS RETURN for imaginary part'); pause stem(n,imag(x)); xlabel('Time index n');ylabel('Amplitude');title('Imaginary part'); Type in real exponent =-1/12 Type in imaginary exponent =pi/6 Type in the gain constant =1 Type in length of sequence =40 2-2-2. a = input('Type in argument = '); K = input('Type in the gain constant = '); N = input ('Type in length of sequence = '); n = 0:N; x = K*a.^n; stem(n,x); xlabel('Time index n');ylabel('Amplitude'); title(['\alpha = ',num2str(a)]); Type in argument = 1.2 Type in the gain constant = 0.2 Type in length of sequence = 30 Type in argument = 0.9 Type in the gain constant = 20 Type in length of sequence = 30 2-2-3 w = input('Type in argument = '); N = input ('Type in length of sequence = '); n = 0:N; y = 1.5.*cos(w.*n); stem(n,y);axis([0 40 -2 2]); xlabel('Time index n');ylabel('Amplitude'); title(['wo = ',num2str(w/pi),'π']); Type in argument = 0.1*pi Type in length of sequence = 40 2-3-1 R=50; d=rand(R,1)-0.5; m=0:1:R-1; s=2*m.*(0.9.^m); x=s+d'; plot(m,d,'r-',m,s,'b--',m,x,'g:') xlabel('Time index n');ylabel('Amplitude'); legend('d[n]','s[n]','x[n]'); pause M=input('Number of input samples ='); b=ones(M,1)/M; y=filter(b,1,x); plot(m,s,'r-',m,y,'b--') legend('s[n]','y[n]'); xlabel('Time index n');ylabel('Amplitude');title(['M= ',num2str(M)]); Number of input samples =3 2-3-2 R=50; d=rand(R,1)-0.4; m=0:1:R-1; s=2*m.*(0.9.^m); x=s+d'; M=input('Number of input sample ='); d=rand(R,1)-0.4; x=s+d'; x2=[zeros(1,(M-1)),x]; for i=1:R; sum=0; for g=1:M; sum=sum+x2(i+g-1); end y(i)=sum./M; end plot(m,s,'r-',m,y,'b--');length(y) legend('s[n]','y[n]'); xlabel('Time index n');ylabel('Amplitude');title(['M= ',num2str(M)]); Number of input sample =3 2-4-1 N = input('Median Filter Length = '); R = 50; a = rand(1,R)-0.4; b = round(a); m = 0:R-1; s = 2*m.*(0.9.^m); x = s + b; y = medfilt1(x,N); subplot(2,1,1) stem(m,x);axis([0 50 -1 8]); xlabel('n');ylabel('Amplitude'); title('Impulse Noise Corrupted Signal'); subplot(2,1,2) stem(m,y); xlabel('n');ylabel('Amplitude'); title('Output of Median Filter'); Median Filter Length = 3 2-4-2 R=50; a=rand(1,R)-0.4; b=round(a); m=0:R-1; s=2*m.*(0.9.^m); x=s+b; M=input('Number of input samples = '); x2=[zeros(1,(M-1)/2),x,zeros(1,(M-1)/2)]; for i=1:R; c=sort(x2(i:i+M-1)); if mod(M,2)==1; y(i)=c((M+1)/2); else y(i)=(c(M/2)+c(M/2+1))/2; end end subplot(2,1,1) stem(m,x);axis([0 50 -1 8]); xlabel('n');ylabel('Amplitude'); title('Tmpulse Noise Corrupted Signal'); subplot(2,1,2) stem(m,y); xlabel('n');ylabel('Amplitude'); title('Output of Median Filter'); Number of input samples =3 2-6 a = input('Type in the first sequence = '); b = input('Type in the second sequence = '); c = conv(a, b); M = length(c)-1; n = 0:1:M; disp('output sequence =');disp(c) stem(n,c) xlabel('Time index n'); ylabel('Amplitude'); Type in the first sequence = [-2 0 1 -1 3] Type in the second sequence = [1 2 0 -1] output sequence = -2 -4 1 3 1 5 1 -3 2-1 2-2-1 2-2-2 2-2-3 2-3-1 2-3-2 2-4-1 2-4-2 2-6
展开阅读全文

开通  VIP会员、SVIP会员  优惠大
下载10份以上建议开通VIP会员
下载20份以上建议开通SVIP会员


开通VIP      成为共赢上传

当前位置:首页 > 教育专区 > 小学其他

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2025 宁波自信网络信息技术有限公司  版权所有

客服电话:4009-655-100  投诉/维权电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服