(‘Normalized frequency’);Рylabel(‘Gain,dB’);Рdisp(‘Numerator ploynomial’);Рfprintf(‘%.4e\n’,numd);Рdisp(‘Denominator ploynomial’);Рfprintf(‘%.4e\n’,dend);Р%计算Ap和AsРW=[Wp Ws];Рh=freqz(numd,dend,w);Рfprintf(‘Ap=%.4f\n’,-20*log10(abs(h(1))));Рfprintf(‘As=%.4f\n’,-20*log10(abs(h(2))));Р运行结果为РNumerator ploynomialР0.0000e+000Р2.3231e-002Р1.7880e-002Р0.0000e+000РDenominator ploynomialР1.0000e+000Р-2.2230e+000Р1.7193e+000Р-4.5520e-001РAp=0.0000РAs=0.0000Р该数字滤波器的增益响应如图2.4所示。Р图2.4 例一数字滤波器的增益响应Р例二:试用Kaiser窗设计满足下列指标的FIR高通滤波器РΩp=0.4πrad,Ωs=0.6πrad,δs=0.01Р解:设计满足上述指标数字滤波器的MATLAB程序如下:Р%Kaiser窗设计FIR高通滤波器РRs=0.01;Рf=[0.4,0.6];Рa=[0,1];Рdev=Rs*ones(1,length(a));Р[M,Wc,beta,ftype]=kaiserord(f,a,dev);Р%使滤波器为Ⅰ型РM=mod(M,2)+M;Рh=fir1(M,Wc,ftype,kaiser(M+1,beta));Рomega=linspace(0,pi,512);Рmag=freqz(h,[1],omega);