Saturday 17 September 2011

IIR filter


IIR FILTER DESIGN

clc;
close all;
clear all;
rp=input('enter the pass band ripple');
rs=input('enter the stop band ripple');
wp=input('enter the pass band freq');
ws=input('enter the stop band freq');
fs=input('enter the sampling feq');
w1=2*wp/fs;
w2=2*ws/fs;
[h,wn]=buttord(w1,w2,rp,rs);
[b,a]=butter(h,wn);
w=0:.01:pi;
[h,om]=freqz(b,a,w);
m=20*log10(abs(h));
an=angle(h);
subplot(2,1,1);
plot(om/pi,m);
ylabel('gain in db....>');
xlabel('(a) normalised frequency>');
subplot(2,1,2);
plot(om/pi,an);
xlabel('(b) normalised frequency');
ylabel('phase in radian');

0 comments:

Post a Comment