Program code
clc;
clear all;
close all;
fp1=input ('Please input
the first pass band frequency = ');
fs1=input ('Please input
the first stop band frequency = ');
fp2=input ('Please input
the second pass band frequency = ');
fs2=input ('Please input
the second stop band frequency = ');
rp=input ('Please input
the pass band attenuation = ');
rs=input ('Please input
the stop band attenuation = ');
sf=input ('Please input
the sampling frequency = ');
p1=2*fp1/sf;
s1=2*fs1/sf;
p2=2*fp2/sf;
s2=2*fs2/sf;
p=[p1,p2];
s=[s1,s2];
[n,w]=buttord(p,s,rp,rs);
[f1,f2]=butter (n,w,'bandpass');
freqz(f1,f2);
title ('Butterworth
Band Pass Filter');
Example of output
Please input the
first pass band frequency = 2000
Please input the
first stop band frequency = 1700
Please input the
second pass band frequency = 3000
Please input the
second stop band frequency = 3200
Please input the
pass band attenuation = 0.5
Please input the
stop band attenuation = 60
Please
input the sampling frequency = 9000_____________________________