matlab上机完美版

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

1.已知3阶椭圆IIR数字低通滤波器的性能指标为:通带截止频率0.4π,通带波纹为0.6dB,最小阻带衰减为32dB。设计一个6阶全通滤波器对其通带的群延时进行均衡。绘制低通滤波器和级联滤波器的群延时。%Q1_solution%ellip(N,Ap,Ast,Wp)%N---Theorderofthefilter%Ap--rippleinthepassband%Ast-astopbandRsdBdownfromthepeakvalueinthepassband%Wp--thepassbandwidth[be,ae]=ellip(3,0.6,32,0.4);hellip=dfilt.df2(be,ae);f=0:0.001:0.4;g=grpdelay(hellip,f,2);g1=max(g)-g;[b,a,tau]=iirgrpdelay(6,f,[00.4],g1);hallpass=dfilt.df2(b,a);hoverall=cascade(hallpass,hellip);hFVT=fvtool([hellip,hoverall]);set(hFVT,'Filter',[hellip,hoverall]);legend(hFVT,'LowpassEllipticfilter','Compensatedfilter');clear;[num1,den1]=ellip(3,0.6,32,0.4);[GdH,w]=grpdelay(num1,den1,512);plot(w/pi,GdH);gridxlabel('\omega/\pi');ylabel('Groupdelay,samples');F=0:0.001:0.4;g=grpdelay(num1,den1,F,2);%EqualizethepassbandGd=max(g)-g;%Designtheallpassdelayequalizer[num2,den2]=iirgrpdelay(6,F,[0,0.4],Gd);[GdA,w]=grpdelay(num2,den2,512);holdon;plot(w/pi,GdH+GdA,'r');legend('OriginalFilter','Compensatedfilter');2.设计巴特沃兹模拟低通滤波器,其滤波器的阶数和3-dB截止频率由键盘输入,程序能根据输入的参数,绘制滤波器的增益响应。clear;N=input('TypeintheorderN=');Wn=input('Typeinthe3-dBcutofffrequencyWn=');%模拟频率[num,den]=butter(N,Wn,'s');w=0:2*Wn;h=freqs(num,den,w);plot(w,20*log(abs(h))),grid;3.已知系统的系统函数为:12123410.20.5()13.21.50.81.4zzHzzzzz用MATLAB进行部分分式展开,并写出展开后的表达式。%Partial-FractionExpansionofRationalz-Transformnum=[001-0.20.5];den=[13.21.5-0.81.4];[r,p,k]=residuez(num,den);disp('Residues');disp(r')disp('Poles');disp(p')disp('Constants');disp(k)4.设计切比雪夫I型IIR数字高通滤波器,其性能指标为:通带波纹0.5dBp,最小阻带衰减43dBs,通带和阻带边缘频率0.75radp和0.35rads绘制所设计的滤波器增益响应。%a4disp('prewappingisdone,andT=2');Wp=tan(0.75*pi/2);Ws=tan(0.5*pi/2);Rp=0.5;Rs=43;[N,Wn]=cheb1ord(Ws,Wp,Rp,Rs,'s');[b,a]=cheby1(N,Rp,Wn,'s');[bt,at]=lp2hp(b,a,Wp);[num,den]=bilinear(bt,at,0.5);[h,omega]=freqz(num,den);plot(omega/pi,20*log10(abs(h)));grid;xlabel('\omega/\pi');ylabel('Gain');title('TypeIChebyshevHighpassFilter');clear;%预畸变Rp=0.5;Rs=43;Wp=0.75;Ws=0.35;[N,Wp]=cheb1ord(Wp,Ws,Rp,Rs);[num,den]=cheby1(N,Rp,Wp,'high');w=0:pi/1024:pi;h=freqz(num,den,w);subplot(2,1,1);plot(w/pi,abs(h)),grid;title('Amplitudeinlinearscale')subplot(2,1,2);plot(w/pi,20*log10(abs(h))),grid;title('Amplitudeinlogscale')5.已知复指数序列为:(0.40.5)[]0.2jnxne,绘制30点该序列的实部和虚部。n=0:29;x=0.2*exp((0.4+1i*0.5)*n);subplot(211);stem(n,real(x));xlabel('n');ylabel('realpart');gridon;subplot(212);stem(n,imag(x));xlabel('n');ylabel('imagpart');gridon;6.设计切比雪夫I型模拟低通滤波器,其滤波器的阶数,3-dB截止频率和通带的波纹由键盘输入,程序能根据输入的参数,绘制滤波器的增益响应。clear;N=input('滤波器阶数N=');Wn=input('截止频率Wn=');Rp=input('通带波纹Rp=');[num,den]=cheby1(N,Rp,Wn,'s');w=0:5*Wn;h=freqs(num,den,w);plot(w,20*log10(abs(h))),grid;xlabel('Frequency,Hz');ylabel('Gain,dB');7.已知系统的系统函数为:111210.61.8()0.213.212.4(12.4)Hzzzz用MATLAB求系统z变换的有理形式,并写出有理形式的表达式。r=[10.61.8];p=[-3.22.42.4];k=0.2;[num,den]=residuez(r,p,k)8.设计巴特沃兹IIR数字带通滤波器,其性能指标为:归一化通带截止频率为120.4,0.6pp,归一化阻带截止频率为120.3,0.7ss,通带波纹为0.6dB,最小阻带衰减为35dB。绘制所设计的滤波器增益响应。%DesignofIIRButterworthBandpassFilterWp=[0.40.6];Ws=[0.30.7];Rp=0.6;Rs=35;[N,Wn]=buttord(Wp,Ws,Rp,Rs);[b,a]=butter(N,Wn);[h,omega]=freqz(b,a,256);plot(omega/pi,abs(h));grid;xlabel('\omega/\pi');ylabel('Gain');title('IIRButterworthBandpassFilter');disp(N);disp(Wn);9.已知指数序列为:[]2(0.9)nxn,绘制24点该序列。n=0:23;x=2*0.9.^n;stem(n,x,'.');gridon;ylabel('Amplitude');xlabel('Timeindex');10.设计椭圆模拟低通滤波器,其滤波器的阶数,3-dB截止频率,通带的波纹和阻带衰减由键盘输入,程序能根据输入的参数,绘制滤波器的增益响应。clear;N=input('TypeintheorderN=');Wn=input('Typeinthe3-dBcutofffrequencyWn=');Rp=input('TypeinthethepassbandrippleRp=');Rs=input('TypeinthetheminimumstopbandattenuationRs=');[num,den]=ellip(N,Rp,Rs,Wn,'s');w=0:5*Wn;h=freqs(num,den,w);plot(w,20*log10(abs(h))),grid;xlabel('Frequency,Hz');ylabel('Gain,dB');11.已知系统的系统函数为:12123410.20.5()13.21.50.81.4zzHzzzzz用MATLAB的impz函数求h[n]的前30个样本值。clc;A=[13.21.5-0.81.4];B=[1-0.20.5];[H,T]=impz(B,A,30);disp(H);stem(T,H);12.已知5阶椭圆IIR数字低通滤波器的性能指标为:通带截止频率0.35π,通带波纹为0.8dB,最小阻带衰减为35dB。设计一个10阶全通滤波器对其通带的群延时进行均衡。绘制低通滤波器和级联滤波器的群延时。%ellip(N,Ap,Ast,Wp)%N---Theorderofthefilter%Ap--rippleinthepassband%Ast-astopbandRsdBdownfromthepeakvalueinthepassband%Wp--thepassbandwidth[be,ae]=ellip(5,0.8,35,0.35);hellip=dfilt.df2(be,ae);f=0:0.001:0.4;g=grpdelay(hellip,f,2);g1=max(g)-g;[b,a,tau]=iirgrpdelay(10,f,[00.4],g1);%thefirstparameteraboveistheorderoftheallpasshallpass=dfilt.df2(b,a);hoverall=cascade(hallpass,hellip);hFVT=fvtool([hellip,hoverall]);set(hFVT,'Filter',[hellip,hoverall]);legend(hFVT,'LowpassEllipticfilter','Compensatedfilter');clear;[num1,den1]=ellip(5,0.8,35,0.35);[GdH,w]=grpdelay(num1,den1,512);plot(w/pi,GdH);gridxlabel('\omega/\pi');ylabel('Groupdelay,samples');F=0:0.001:0.4;g=grpdelay(num1,den1,F,2);%EqualizethepassbandGd=max(g)-g;%Designtheallpassdelayequalizer[num2,den2]=iirgrpdelay(10,F,[0,0.4],Gd);[GdA,w]=grpdelay(num2,den2,512);holdon;plot(w/pi,GdH+GdA,'r');legend('OriginalFilter','Compensatedfilter');13.编写4点滑动平均滤波器程序。原始未受干扰的序列为:s[n]=3[n(0.8)n],加性噪声信号d[n]为随机序列,幅度0.6,受干扰的序列为:x[n]=s[n]+d[n],分别绘制长度为40的原始未受干扰的序列,噪声序列和受干扰序列,以及滑动平均滤波器的输出。%Program2_4%SignalSmoothingbya

1 / 19
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功