资源描述:
《数字信号处理DSP实验四报告》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、Example:DesignofaButterworthLowpassDigitalFilterbyusingbilinearmethodbandpassattenuation1dBbandstopattenuation40dBbandpassedgefrequency400hzbandstopedgefrequency500hzsamlingfrequency2000hzclc;clearallRp=1;%bandpassattenuationindB带通衰减带通截至频率带阻截至频率采样频率Rs=40;%bandstopattenuationin
2、dB带阻衰减OmegaPl_l=400;%bandpassedgefrequencyOmegaSl_l=500;%bandstopedgefrequencyFp=2000;%samlingfrequency%changeanalogfrequencytodigitalangularWpl=2*pi*0megaPl_l/Fp;frequencyWs1=2*pi*OmegaSl_l/Fp;%changeanalogfrequencytodigitalangular数字参数frequency0megaPl=2*Fp*tan(Wpl/2);%nonline
3、arlization转换为模拟参数OmegaS1=2*Fp*tan(Wsl/2);%nonlinearlizationEta_P=OmegaPl/OmegaPl;%NormalizationEta_S=OmegaSl/OmegaPl;%Normalization一化Lemta_P_EquivalentLowPass=Eta_P;%changetotheequivalentLowpasspatameterLemta_S_EquivalentLowPass=Eta_S;%%changetotheequivalentLowpasspatameter变量命
4、名%EstimatetheFilterOrder[N,Wn]=buttord(Lemta_P_EquivalentLowPass,Lemta_S_EquivalentLowPass,Rp,Rs,1s1);%DesigntheFilter[numl.deni]=butter(N.Wn,1s1);[num2.den2]=lp21p(numl,deni,OmegaPl);[num,den]=bilinear(num2,den2,Fp);%Computethegainresponsew=0:pi/255:pi;h=freqz(num,den,w);g=20
5、*logl0(abs(h));%Plotthegainresponsefigure;plot(w/pi,g);gridaxis([01-605]);xlabel(
6、omegm/pi');ylabelLGainindB1);title(1GainResponseofaButterworthLowpassFilter1);result:GainResponseofaButterworthLowpassFilter0-10-20-30-40-50-6000.10.20.30.40.50.60.70.80.91cd/k8Pu一weeExperiment
7、:1DesignofaChebylHighpassDigitalFilterbyusingbilinearmethodbandpassattenuation1dBbandstopattenuation32dBbandpassedgefrequency800hzbandstopedgefrequency500hzsamlingfrequency2000hzcode:clc;clearallRp=l;Rs=32;OmegaPl_l=800;OmegaSl_l=500;Fp=2000;Wpl=2*pi*OmegaPl_l/Fp;Ws1=2*pi*Omeg
8、aSl_l/Fp;%digtalfreguency0megaPl=2*Fp*tan(Wpl/2);0megaSl=2*Fp*tan(Wsl/2);%changeintoanologfrequency%归一化Eta_P=OmegaPl/OmegaPl;EtaS=0megaSl/0megaPl;[N,Wn]=cheblord(l,l/Eta_S,Rp,Rs/s);[B/A]=chebyl(N,l,Wn,'S');[Bl;AT]=lp2hp(B,A,Eta_S);[num,den]=bilinear(BT,A'T;0.5);%MAYBEERRORw=0:
9、pi/255:pi;h=freqz(num,den,w);g=20*logl0(abs(h));figure;plot(w