Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

clc;

close all;
clear all;
D1=0.6;%PASSBAND RIPPLE
D2=0.1;%STOPBAND ATTENUATION
wp=0.7*pi%digital passband
ws=0.35*pi%digital stopband
T=1;
os=2/T*tan(ws/2)%analog stopband frequency
op=2/T*tan(wp/2)%analog passband frequency
%Order of the filter
Rp=-20*log10(D1)%STOPBAND RIPPLE in decibel
Rs=-20*log10(D2)%PASSBAND RIPPLE in decibel

[N,CF]=buttord(op,os,Rp,Rs,'s')
% To get transfer function
disp('normailzed')
[n,d]=butter(N,1,'s')
tf(n,d);
disp('Denormalized')
[n1,d1]=butter(N,CF,'s');
sys=tf(n1,d1);
[n2,d2]=bilinear(n1,d1,1/T);
tf(n2,d2,T);
w=0:0.01:pi;
h=freqz(n2,d2,w);
plot(w,abs(h))
title('Butterworth filter using BILINEAR')
xlabel('frequency')
ylabel('magnitude')
grid on

Butterworth filter using BILINEAR

1
0.9
0.8

m a gnitude

0.7
0.6
0.5
0.4
0.3
0.2
0.1
0

0.5

1.5
2
frequency

2.5

3.5

You might also like