RF Wireless World

Home of RF and Wireless Vendors and Resources

One Stop For Your RF and Wireless Need

Low Pass IIR butterworth digital filter MATLAB source code

This section of MATLAB source code covers BUTTERWORTH IIR digital filter matlab code.It describes Low Pass IIR filter.

IIR digital filter works on digital samples. It uses current input sample,previous input samples as well as previous output samples to produce current output sample.

IIR Filter Specifications

Following points are usually considered to design FIR filter other the window type.
INPUT:
• Passband and stopband ripples
• passband and stopband edge frequencies
• sampling frequency
• order of the filter
• filter coefficients
OUTPUT:
• magnitude and phase responses

Entering Input parameters

clc;close all;clear all;
format long
rp=input('enter the passband ripple(Example:0.5):');
rs=input('enter the stopband ripple(Example:60):');
wp=input('enter the passband freq(Example:1300):');
ws=input('enter the stopband freq(Example:2600):');
fs=input('enter the sampling freq(Example:10000):');

IIR MATLAB Function main part

w1=2*wp/fs;w2=2*ws/fs;
[n,wn]=buttord(w1,w2,rp,rs);
[b,a]=butter(n,wn);
w=0:.01:pi;
[h,om]=freqz(b,a,w);
m=20*log10(abs(h));
an=angle(h);

figure;plot(om/pi,m);title('IIR Filter magnitude Response');ylabel('Gain in dB');xlabel('Normalised frequency');
figure;plot(om/pi,an);title('IIR Filter phase Response');xlabel('Normalised frequency');ylabel('Phase in radians');