南理工数字信号处理matlab题库53页.doc
《南理工数字信号处理matlab题库53页.doc》由会员分享,可在线阅读,更多相关《南理工数字信号处理matlab题库53页.doc(53页珍藏版)》请在三一文库上搜索。
1、DSP题库详解1已知3阶椭圆IIR数字低通滤波器的性能指标为:通带截止频率04门,通带波纹为0.6dB, 最小阻带衰减为32dBo设计一个6阶全通滤波器对其通带的群延时进行均衡。绘制低通滤 波器和级联滤波器的群延时。%Progranm 1% Group-delay equalization of an IIR filter.%n,d = ellip(3,0.6,32,0.4);GdH,w = grpdelay(n,dz512);plot(w/pi,GdH); gridxlabel(omega/pi); ylabel(Group delay, samples);title(Original Fi
2、lter*);F = 0:0.001:0.4;g = grpdelay(nF,2);% Equalize the passbandGd = max(g)-g;% Design the al I pass delay equalizernumzden,tau = iirgrpdelay(6, F, 0 0.4, Gd);%设计六阶的全通滤波器bza=iirgrpdelay(6,F,0 0.4,Gd);Hel=dfilt.df2(bza);He=dfilt.df2(n,d);He_all=dfilt.cascade(He,Hel);grpdelay(He_all)%DFILT:Digital Fi
3、lter Implementation.%GdA,w = grpdelay(num,den,512);%figure(2);%plot(w/pi,GdH+GdA); grid%xlabel(omega/pi,);ylabel(Group delay, samples);%title(fGroup Delay Equalized Filter1);2设计巴特沃兹模拟低通滤波器,其滤波器的阶数和3dB截止频率由键盘输入,程序能根 据输入的参数,绘制滤波器的增益响应。% Program 2% Program to Design Butterworth Analog Lowpass Filter% T
4、ype in the filter order and passband edge frequency 设计边缘频率N = input(Type in filter order =);Wn = input(3-dB cutoff angular frequency =);% Determine the transfer functionnum,den = butter(N,Wn,s*);%计算滤波器的分子和分母% Compute and plot the frequency responseh,w=freqz( nu mzden);plot (w/pi,20*logl0(abs(h);xlab
5、el(、omega/pi); ylabel(Magnitude, dB);title(The magnitude respponse of the system1)axis(0 3 -80 5)3% To use the residuenum=lz-0.2,0.5,0,0;den=l,3.2z1.5,-0.8,1.4;rzP/k=residue (nu m,de n)4% Program 4% Chebyl analog highpass filter design%Wp=0.75;Ws=0.35;Rs=43;Rp=0.5;N,Wn=cheblord(Wp,WszRp,Rs/s,);% Det
6、ermine the coefficients of the transfer function numzden=chebyl(NzRpzWn/high7s);% Compute and plot the frequency responseomega=0:l:30*pi;%w=0:0.01:pi;h=freqs(num,denzomega);%plot(w/pi,20*logl0(abs(h)plot(omega/(2*pi),20*logl0(abs(h);xlabel(、omega/pr);ylabel(Mag nitude,dB);title(IIR Chebyshevl Highpa
7、ss Filter/digital)5.% Program to绘制30点序列的实部与虚部%n=0:29;x=0.2*exp(0.4+0.5*j).*n);subplot(lz2,l)stem(nzreal(x)title(The real part );xlabel(rT);ylabel(mag nitude1)subplot( 1,2,2)stem(n,imag(x)title(The imagine part)xlabelCnJjylabelCmag nitude1)6.% Program to Design Type 1 Chebyshev analog Lowpass Filter%
8、 % Read in the filter order, passband edge frequency% and passband ripple in dBN = input(Order =);Wc = input(type in the 3 dB cutoff frequency=);Rp = input( Type in the peak ripple value in passband:);% Determine the coefficients of the transfer functionnum,den = chebyl(N,Rp/Wc,s);% Compute and plot
9、 the frequency responseh,w=freqs( nu m,de n);plot (w/pi,20*logl0(abs(h);xlabel(fFrequency,Hz1); ylabel(fmagnitude, dB);titleCIIR Chebyshevl Lowpass Filter/analog1)grid on7.% Determination of the Factored Form% of a Rational z-Transform%熟悉命令numzden=residuez(r,p,k); r,p,k=residuez(numzden)clear allr =
10、 1 0.6 1.8;p =-3.2 2.4 2.4;k =0.2;num, den = residuez(r,pzk);dispCNumerator polynomial coefficients); disp(num)disp(Denominator polynomial coefficients); disp(den)8, 设计IIR数字带通滤波器% Program to Design iir digital bandpass Filter clear allWp = 0.4 0.6;的性质%Wp and Ws都是向量组,带通Ws = 0.3 0.7;Rp = 0.6;Rs = 35;N
11、Wn = buttord(Wp, Ws, Rp, Rs);bza = butter(N,Wn);h,w = freqz(b,az256);数%巴特卧兹滤波器的分子和分母%求出在频域的画图点,256,即要花的点gain = 20*logl0(abs(h);plot (w/pi,gain);grid onxlabel(、omega/pi); ylabel(magnitude, dB);title(IIR Butterworth Bandpass Filter);9%draw the requested sequeneeclearn=0:23;x=2*0.9.An;stem(n,x)titleCx
12、tn1)xlabel(n);ylabel(mag nitude)grid on10%椭圆模拟低通滤波器设% Program to Design Elliptic analog Lowpass Filter 计% Read in the filter order, passband edge frequency,% passband ripple in dB and minimum stopband % attenuation in dBN = input(fOrder =);Wn = input(type in the 3 dB cutoff frequency= *);Rp = input(
13、ftype in the peak ripple value of passband in dB =);Rs = inputCtype in the Minimum stopband attenuation in dB = !);num,den = ellip(NzRp,RszWn,s); %Determine the coefficients of the transfer function% Compute and plot the frequency responseh,w=freqs( nu m,de n);plot (w/2*pi,20*logl0(abs(h);xlabel(fFr
14、equencyz Hz1); ylabel(!Gain, dB!);titlefiir ellip lowpass filter?gird on%num=lz-0.2,0.5;den=lz3.2,1.5,-0.8,1.4;y= impz(num,de n,30);n=l:30;stem(n,y);grid on%clearN=5;Rp=0.8;Rs=35;Wn=0.35;%in verse 一tran sform%去掉了 pi的输入num,den = ellip(N,RpzRszW n);F = 0:0.01:0.3;GdH,w = grpdelay(numzden,512);%gd=grpd
15、elay(numzdenzw,2);群时延的另外一个公式 figure(l),plot(w/pi,GdH);gridxlabel(omega/pi); ylabel(Group delay, samples);title(The grpdelay of HR Ellip Lowpass Filter)g = grpdelay(numzdenF,2);% Equalizethe passbandGd = max(g)-g;% Desig n the al I pass delay equalizernum,den = iirgrpdelay(10, F, 0 0.3, Gd);He=dfilt.
16、df2(num,den);Hel=dfilt.df2(numzden);He_all=dfilt.cascade(He,Hel);grpdelay(He_all)%下面是另外一种方法%GdA,w = grpdelay(numzden,512);%plot(w/pi,GdH+GdA); grid on%xlabel(omega/pi,);ylabel(Group delay, samples);%title(Group Delay Equalized Filter);13%Program to draw signal and signal with noise clearN=40;n=0:N-l
17、s=3*(n.*(0.8.An);d=1.2.*rand(l,N)-0.6;x=s+d;figure(l)stem(nzs)xlabel(!time index nJ; ylabelCamplitude);titleCoriginal signal sn) figure(2)stem(nzd)title(noise dn)xlabeftime index rT); ylabel(amplitude)figure(3)stem(n,x)title(signal with noise xfn1)xlabel(time index rT); ylabeKmplitude1)%window leng
18、th is 4% let signal go through the filter%在图上加方框对其标注%generate moving average filterb=ones(4,l)/4;y=filter(b,l,x);figure(4)stem(nzy)title(signal through filter yn)xlabel(ftime index rT); ylabel(amplitude) figure(5)plot(n,d,g:ms,b 九 x,cYnMr-);Iegend(,noise7sn7xn7yn)grid on14%N=10;x=ones(l,10);h,w=freq
19、z(x,l,16);subplot(2,lzl)plot(w,abs(h)xlabel(omega/*); ylabelCamplitudeJjtitleCamplitude response)subplot(2,lz2)plot(wzangle(h)xlabel(omega/*); ylabel(,phase(rad);title(phase response*)%notice: here omega has nt bee n 归一化15%已知系统的系统函数为:%用MATLAB的filter函数求hn的前20个样本clearN=20;num=lz-0.2z0.5;den=lz3.2z1.5,
20、0.8,1.4;x=zeros(l,N);x(l)=l;%x=l,zeros(l,19)h=filter( nu mzde n,x);y=impz(numzden,N);%用 filter 和 z 反变换 impz 对比subplot(2zl,l)stem(0:N-l,h)titleChtn*)subplot(2zlz2)stem(0:N-lzy)titleCytn*)16% unit Hz%desired magnitude%通带和阻带波纹%利用Hermann公式估计FIR低通滤波器的阶数。该滤波器的性能指标为:通带截止频率 为1500Hz,阻带截至频率为1800Hz,通带纹波为=0.01
21、5,阻带纹波为=0.021,抽样频率 为 5000Hz fedge=1500 1800;mval=l 0;values in each banddev=0.015 0.021;Ft=5000;N=remezord(fedgezmval,dev,Ft)%第二种方法% clear all% format long % al=0.005309;a2=0.07114;a3=-0.4761;a4=0.00266;a5=0.5941;a6=0.4278;% bl=11.01217;b2=0.51244;% f=1500,1800;% w=2*pi*f/5000;% wp=w(l);ws=w(2);% de
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 理工 数字信号 处理 matlab 题库 53
