06-05-2011, 03:43 PM
Procedure:-
1) Get the pass band and stop band edge frequencies
2) Get the pass band and stop band ripples
3) Get the sampling frequency
4) Get the order of the filter
5) Find the filter coefficients
6) Plot the magnitude response
MATLAB program for IIR filter
Code:
clear
clc
close all
% ENTER THE PASSBAND FREQUENCY in hz
wp = 500;
% ENTER THE STOPBAND FREQUENCY in hz
ws = 2000;
% ENTER THE PASSBAND RIPPLE & STOPBAND ATTENUATION
Rp = 3;
Rs = 20;
% ENTER THE SAMPLING FREQUENCY
Fs = 8000;
%NORMALIZED SAMPLING FREQUENCY = Fs/2
Fn = Fs/2;
% DESIGN THE ANALOG BUTTERWORTH FILTER ORDER AND CUT-OFF FREQUENCY
[N,wc] = buttord(wp/Fn, ws/Fn, Rp, Rs);
% Design the digital filter coeffecients
[b,a] = butter(N,wc)
% Display the frequency response of the digital filter coeffecients
[H,f] = freqz(b,a,512,8000);
plot(f,20*log10(abs(H)))
RESULT: - IIR FILTER DESIGN