You are on page 1of 4

Aim:- Design a Butterworth filter has following specifications. Pass band edge frequency fp=30hz.

Stop band edge frequency fs=75hz. Pass band gain Ap=0.89 Stop band attenuation=0.2 Sampling frequency=250hz. Using Bilinear Transformation method.
clc; close all; clear all; fp=30;%passband edge freq fs=75;%stopband edge freq FS=250;%sampling freq Ap=0.85;%passband gain Ap=20*log10(0.85); Ap=abs(Ap) As=0.2;%stopband attenuation gain As=20*log10(0.2); As=abs(As) wp=2*pi*(fp/FS) ws=2*pi*(fs/FS) T=1/FS;%sampling time ohmp=(2/T)*tan(wp/2) ohms=(2/T)*tan(ws/2) s1=10^(0.1*As)-1; s2=10^(0.1*Ap)-1; s3=ohms/ohmp; N=((1/2)*(log10(s1/s2))/(log10(s3)))%order of filter N=ceil(N) ohmc=ohmp/(s2^(1/(2*N))) z=[]; for k=1:N z(k)=ohmc*exp(j*(N+2*(k-1)+1)*(pi/(2*N))); end z p=poly(z)%coefficient of bilinear equation q=ohmc^N w=1:1000;

h=freqs(q,p,w); mag=20*log10(abs(h)); figure(1) plot(w,mag); %analog filter ylabel('mag'); xlabel('w'); title('frequency response') %bilinear transform [numr denm]=bilinear(q,p,FS); [g1 g2]=freqz(numr,denm,FS); g=20*log10(abs(g1)); figure(2) plot(g2,g); %digital filter ylabel('mag'); xlabel('z'); title('frequency response')

Results:-

Analog Filters Frequency Response:-

Digital Filters Frequency Response:-

You might also like