Google Search

Wednesday, December 7, 2011

DSP Program for the design of butterworth band pass analog filter


Band Pass: -

%Program for the design of butterworth band pass analog filter
clc;
close all;
clear all;
format long 
rp=input('enter the passband ripple...');
rs=input('enter the stopband ripple...');  
wp=input('enter the passband freq...');
ws=input('enter the stopband freq...');     
fs=input('enter the sampling freq...');
w1=2*wp/fs;
w2=2*ws/fs;                     
[n]=buttord(w1,w2,rp,rs,'s');
wn=[w1 w2];
[b,a]=butter(n,wn,'bandpass','s');
w=0:0.01:pi;
[h,om]=freqs(b,a,w);
m=20*log10(abs(h));
an=angle(h);
subplot(2,1,1);
plot(om/pi,m);
ylabel('GainindB-->');
xlabel('(a)Normalised frequency-->');
subplot(2,1,2);
plot(om/pi,an)
xlabel('(b)Normalised frequency-->');
ylabel('Phase in radians-->'); 

Output: -

enter the passband ripple...0.36
enter the stopband ripple...36
enter the passband freq...1500
enter the stopband freq...2000
enter the sampling freq...6000




0 comments:

Post a Comment