2022年matlab上机完美版全解 .pdf
《2022年matlab上机完美版全解 .pdf》由会员分享,可在线阅读,更多相关《2022年matlab上机完美版全解 .pdf(19页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、1. 已知 3 阶椭圆 IIR 数字低通滤波器的性能指标为:通带截止频率0.4 ,通带波纹为0.6dB,最小阻带衰减为32dB。设计一个 6 阶全通滤波器对其通带的群延时进行均衡。绘制低通滤波器和级联滤波器的群延时。%Q1_solution%ellip(N,Ap,Ast,Wp)/双线性法设计低通滤波器%N-The order of the filter%Ap-ripple in the passband%Ast-a stopband Rs dB down from the peak value in the passband%Wp-the passband widthbe,ae=ellip(3
2、,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,0 0.4,g1);hallpass=dfilt.df2(b,a);/级联hoverall=cascade(hallpass,hellip);hFVT=fvtool(hellip,hoverall);set(hFVT,Filter,hellip,hoverall);legend(hFVT,Lowpass Elliptic filter, Compensated filter);
3、/添加图例的标注clear;num1,den1=ellip(3,0.6,32,0.4);GdH,w=grpdelay(num1,den1,512);plot(w/pi,GdH); gridxlabel(omega/pi); ylabel(Group delay, samples);F=0:0.001:0.4;g=grpdelay(num1,den1,F,2); % Equalize the passbandGd=max(g)-g;% Design the allpass delay equalizernum2,den2=iirgrpdelay(6,F,0,0.4,Gd);GdA,w = grp
4、delay(num2,den2,512);名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 19 页 - - - - - - - - - hold on ;plot(w/pi,GdH+GdA,r); legend(Original Filter, Compensated filter);2设计巴特沃兹模拟低通滤波器,其滤波器的阶数和3-dB 截止频率由键盘输入,程序能根据输入的参数,绘制滤波器的增益响应。clear;N=input(Type in the order N =
5、 );Wn=input(Type in the 3-dB cutoff frequency Wn = ); %模拟频率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.4zzH zzzzz用 MATLAB 进行部分分式展开,并写出展开后的表达式。% Partial-Fraction Expansion of Rational z-Transformnum = 0 0 1 -0.2 0.5;den = 1 3.2
6、1.5 -0.8 1.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.75 radp和0.35 rads绘制所设计的滤波器增益响应。%a4 disp(prewapping is done,and T=2);Wp = tan(0.75*pi/2);Ws = tan(0.5*pi/2);Rp = 0.5;名师资料总结 - - -精品资料
7、欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 19 页 - - - - - - - - - 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);titl
8、e(Type I Chebyshev Highpass Filter);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(Amplitude in linear scale)subplot(2,1,2);plot(w/pi,20*log10(abs(h),grid;title(Amplitude in l
9、og scale)5已知复指数序列为:(0.40.5) 0.2jnx ne,绘制 30 点该序列的实部和虚部。 n=0:29; x=0.2*exp(0.4+1i*0.5)*n); subplot(211); stem(n,real(x); xlabel(n);ylabel(real part); grid on ; subplot(212); stem(n,imag(x); xlabel(n);ylabel(imag part); grid on ;名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - -
10、 - - 第 3 页,共 19 页 - - - - - - - - - 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);
11、7已知系统的系统函数为:111210.61.8( )0.213.212.4(12.4)H zzzz用 MATLAB 求系统 z 变换的有理形式,并写出有理形式的表达式。r=1 0.6 1.8; p=-3.2 2.4 2.4; k=0.2; num, den = residuez(r,p,k)8设计巴特沃兹IIR 数字带通滤波器,其性能指标为:归一化通带截止 频 率 为120.4 ,0.6pp, 归 一 化 阻 带 截 止 频率 为120.3 ,0.7ss, 通带波纹为 0.6dB, 最小阻带衰减为35dB。绘制所设计的滤波器增益响应。% Design of IIR Butterworth Ba
12、ndpass FilterWp =0.4 0.6;名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 4 页,共 19 页 - - - - - - - - - Ws = 0.3 0.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);tit
13、le(IIR Butterworth Bandpass Filter);disp(N);disp(Wn);9已知指数序列为: 2(0.9)nx n,绘制 24 点该序列。 n=0:23; x=2*0.9.n; stem(n,x,.); grid on ; ylabel(Amplitude); xlabel(Time index);10设计椭圆模拟低通滤波器,其滤波器的阶数,3-dB 截止频率,通带的波纹和阻带衰减由键盘输入,程序能根据输入的参数,绘制滤波器的增益响应。clear;N=input(Type in the order N = );Wn=input(Type in the 3-dB
14、cutoff frequency Wn = );Rp=input(Type in the the passband ripple Rp = );Rs=input(Type in the the minimum stopband attenuation Rs = );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已知系统的系统函数为:名师资料总结 - - -精品资料欢迎下载 - - - - -
15、 - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 5 页,共 19 页 - - - - - - - - - 12123410.20.5( )13.21.50.81.4zzH zzzzz用 MATLAB 的 impz 函数求 hn的前 30 个样本值。clc;A=1 3.2 1.5 -0.8 1.4;B=1 -0.2 0.5;H,T=impz(B,A,30);disp(H);stem(T,H);12已知 5 阶椭圆 IIR 数字低通滤波器的性能指标为:通带截止频率0.35 ,通带波纹为0.8dB,最小阻带衰减为35dB。设计一个10阶全通滤波器对
16、其通带的群延时进行均衡。绘制低通滤波器和级联滤波器的群延时。%ellip(N,Ap,Ast,Wp)%N-The order of the filter%Ap-ripple in the passband%Ast-a stopband Rs dB down from the peak value in the passband%Wp-the passband widthbe,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=iirgrpd
17、elay(10,f,0 0.4,g1);%the first parameter above is the order of the allpasshallpass=dfilt.df2(b,a); hoverall=cascade(hallpass,hellip);hFVT=fvtool(hellip,hoverall);set(hFVT,Filter,hellip,hoverall);legend(hFVT,Lowpass Elliptic filter, Compensated filter); clear;num1,den1=ellip(5,0.8,35,0.35);GdH,w=grpd
18、elay(num1,den1,512);plot(w/pi,GdH); grid名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 6 页,共 19 页 - - - - - - - - - xlabel(omega/pi); ylabel(Group delay, samples);F=0:0.001:0.4;g=grpdelay(num1,den1,F,2); % Equalize the passbandGd=max(g)-g;% Design the allpass delay e
19、qualizernum2,den2=iirgrpdelay(10,F,0,0.4,Gd);GdA,w = grpdelay(num2,den2,512);hold on ;plot(w/pi,GdH+GdA,r); legend(Original Filter, Compensated filter);13编写4 点滑动平均滤波器程序。原始未受干扰的序列为:sn=3n(0.8)n,加性噪声信号 dn为随机序列,幅度0.6,受干扰的序列为: xn= sn+ dn ,分别绘制长度为40 的原始未受干扰的序列,噪声序列和受干扰序列,以及滑动平均滤波器的输出。% Program 2_4% Signal
20、 Smoothing by a Moving-Average FilterR = 40;d = 6/5*(rand(1,R)-0.5);m = 0:1:R-1;s =3.*m.*0.8.m;x = s + d;subplot(211);plot(m,d,r-,m,s,b:,m,x,m-)title(The sequence with noise);ylabel(Amplitude)legend(dn, sn, xn);b = ones(4,1)/4;y = fftfilt(b,x);subplot(212);plot(m,s,r-,m,y,b-) title(The original sequ
21、ence & the output sequence);legend(sn, yn);ylabel(Amplitude)14绘制长度为 10点的矩形序列的 16点离散傅立叶变换样本的幅度名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 7 页,共 19 页 - - - - - - - - - 和相位。xn=ones(10,1);Xk=fft(xn,16);Xkf=abs(Xk);Xkp=angle(Xk);subplot(211);stem(0:15,Xkf,filled);xlabe
22、l(Time index/n);ylabel(Magnitude);subplot(212);stem(0:15,Xkp,filled);xlabel(Time index/n);ylabel(Phase)15已知系统的系统函数为:12123410.20.5( )13.21.50.81.4zzH zzzzz用 MATLAB 的 filter 函数求 hn的前 20 个样本值。num=1,-0.2,0.5;den=1,3.2,1.5,-0.8,1.4;x=1 zeros(1,20-1);y=filter(num, den, x);disp(Coefficients of the power se
23、ries expansion);disp(y)stem(y)16利用 Hermann 公式估计 FIR 低通滤波器的阶数。该滤波器的性能指标为:通带截止频率为1500Hz,阻带截止频率为1800Hz,通带波纹为p0.015,阻带波纹为s0.021,抽样频率为5000Hz。% Program 10_1% Estimation of FIR Filter Order Using remezord%clear; fedge = 1500 1800 ;% input(Type in the bandedges = ); mval = 1 0;%input(Desired magnitude value
24、s in each band = ); dev = 0.015 0.021;%input(Allowable deviation in each band = ); FT = 5000;%input(Type in the sampling frequency = ); 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 8 页,共 19 页 - - - - - - - - - N, fpts, mag, wt = remezord(fedge, mval, dev, FT); d =
25、fdesign.lowpass(n,fp,fst,N,0.6,0.72); design(d); fprintf(Filter order is %d n,N); 17编写长度为5 的中值滤波器程序。原始未受干扰的序列为:sn=3n(0.8)n,加性噪声信号 dn为随机序列,幅度0.6,分别绘制长度为 40 的受干扰序列,以及中值滤波器的输出。% Program 2_5% Illustration of Median Filtering%N = 5;R = 40; b = 6/5*(rand(1,R)-0.5); % Generate impulse noisem = 0:R-1;s = 3*
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 2022年matlab上机完美版全解 2022 matlab 上机 完美 版全解
限制150内