仪器社区

在MATLAB环境下设计带阻滤波器的程序

fpxxhsd 2016-06-01
评论
全部评论
梦色未央
clear all;

fp=[200 500];通带上下限
fs=[300 400];阻带
rp=3;rs=18;衰减db
Fs=2000;
wp=fp*2*pi/Fs;
ws=fs*2*pi/Fs;
%
% Firstly to finish frequency prewarping;
wap=2*Fs*tan(wp./2)
was=2*Fs*tan(ws./2);
[n,wn]=buttord(wap,was,rp,rs,'s');
% Note: 's'!
[z,p,k]=buttap(n);
[bp,ap]=zp2tf(z,p,k)
%
bw=wap(2)-wap(1)
w0=sqrt(wap(1)*wap(2))
[bs,as]=lp2bs(bp,ap,w0,bw)
%带阻
[h1,w1]=freqs(bp,ap);
figure(1)
plot(w1,abs(h1));grid;
ylabel(' lowpass G(p)')
%
w2=[0:Fs/2-1]*2*pi;
h2=freqs(bs,as,w2);
% Note: z=(2/Ts)(z-1)/(z+1);
[bz1,az1]=bilinear(bs,as,Fs) %双线性变换
[h3,w3]=freqz(bz1,az1,1000,Fs);
figure(2)
plot(w2/2/pi,20*log10(abs(h2)),w3,20*log10(abs(h3)));grid;
ylabel('Bandpass AF and DF')
xlabel(' Hz')
4 0 2016-06-02 0条评论 回复
您可能感兴趣的社区主题
加载中...
发布 评论