Butterfly

mail@pastecode.io avatar
unknown
plain_text
9 days ago
545 B
2
Indexable
Never
clc;clear all;close all;
%butterworth - Bilinear Transformation
wp=0.2;%rad
ws=0.3;%rad
bwp=2*tan(wp/2);
bws=2*tan(ws/2);
[bNb,bwh]=buttord(bwp,bws,alphamax,alphamin,'s')
[b1,a1]=butter(bNb,bwh,'s')
figure
sys=tf(b1,a1)
bode(sys);
figure;
[num1 den1]=bilinear(b1,a1,1);
freqz(num1,den1)
HZ=tf(num1,den1,1)
% Testing the low pass filter 

ts=1/5000;
n=0:499;
x=cos(2*pi*250*n*ts); % x=cos(0.08*pi*n)+cos(pi*n);
%x=cos(2*pi*10*n*ts)+cos(2*pi*250*n*ts); 
y=filter(num1,den1,x)
figure;
subplot(2,1,1)
stem(x(400:499))
subplot(2,1,2)
stem(y(400:499))
Leave a Comment