数字低通滤波器各种形式实现

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

%The normalized specfication Wp=2*fp/Fs; Ws=2*fs/Fs;
%% %Q1-1 %Butterworth %get the minimum order [N1,Wp1]=buttord(Wp,Ws,Rp,As); disp('Butterworth'); disp('minimum order:'); disp(N1); %get and display coefficient of numerator and denominator [b1,a1]=butter(N1,Wp1); disp('numerator'); disp(b1); disp('denominator'); disp(a1); %plot the frequency response figure(1) [h1,w1]=freqz(b1,a1,2048); plot(w1/pi,20*log10(abs(h1))) grid on xlabel('\omega/ \pi'),ylabel('Magnitude(dB)') title('Butterworth'); axis([0,1,-50,5]);
%% %Q1-5 %Linear-phase FIR filter with Hamming and Hann window %normalized passband frequency and stopband frequency wc=(Ws+Wp)/2; dw=Ws-Wp; %Hamming N_Hamming=ceil(3.32*pi/dw)+1; b_Hamming=fir1(N_Hamming,wc,hamming(N_Hamming+1)); disp('Linear-phase FIR filter with Kaiser window'); disp('minimum order:'); disp(N_Hamming); %plot the frequency and phase response figure(5) freqz(b_Hamming,1,512); grid on xlabel('Normalized Frequency(\times\pi rad/sample)'),ylabel('Magnitude(dB)') title('Linear-phase FIR filter with Hamming window') %Hann
%% %Q1-3 %Chebyshev Type 2 %get the minimum order [N3,Wp3]=cheb2ord(Wp,Ws,Rp,As); disp('Chebyshev TypeII'); disp('minimum order:'); disp(N3); %calculate and display coefficient of numerator and denominator [b3,a3]=cheby2(N3,Rp,Wp); disp('numerator'); disp(b3); disp('denominator'); disp(a3); %plot the frequency response figure(3) freqz(b3,a3,1024,Fs); grid on xlabel('Frequency(Hz)'),ylabel('Magnitude(dB)') title('Chebyshev TypeII') axis([0,12000,-50,5]);
ቤተ መጻሕፍቲ ባይዱ
%% %Q1-2 %Chebyshev Type 1 %calculates the minimum order [N2,Wp2]=cheb1ord(Wp,Ws,Rp,As); disp('Chebyshev TypeI'); disp('minimum order:'); disp(N1); %get and display coefficient of numerator and denominator [b2,a2]=cheby1(N2,Rp,Wp); disp('numerator'); disp(b2); disp('denominator'); disp(a2); %plot the frequency response figure(2) freqz(b2,a2,1024,Fs); grid on xlabel('Frequency(Hz)'),ylabel('Magnitude(dB)') title('Chebyshev TypeI') axis([0,12000,-50,5]);
%% %Q1-4 %Elliptic %get the minimum order [N4,Wp4]=ellipord(Wp,Ws,Rp,As); disp('Elliptic'); disp('minimum order:'); disp(N4); %get and display coefficient of numerator and denominator [b4,a4]=ellip(N4,Rp,As,Wp); disp('numerator'); disp(b4); disp('denominator'); disp(a4); %plot the frequency response figure(4) freqz(b4,a4,1024,Fs); grid on xlabel('Frequency(Hz)'),ylabel('Magnitude(dB)') title('Elliptic') axis([0,12000,-50,5]);
N_Hann=ceil(3.11*pi/dw)+1; disp('Linear-phase FIR filter with Hann window'); disp('minimum order:'); disp(N_Hann); b_Hann=fir1(N_Hann,wc,hann(N_Hann+1)); %plot the frequency and phase response figure(6) freqz(b_Hann,1,512); grid on xlabel('Normalized Frequency(\times\pi rad/sample)'),ylabel('Magnitude(dB)') title('Linear-phase FIR filter with Hann window')
%Q1
%Digital LoWpass Filter Design
%Sampling Rate
48KHz
%Passband Frequency 8KHz
%Stopband Frequency 10KHz
%Passband ripple
1dB
%Stopband attenuation 40dB
%
%The desired specfication Fs=48000; fp=8000; fs=10000; Rp=1; As=40;
相关文档
最新文档