MATLAB PROGRAM FOR IIR:
To write a program for IIR(inite Impulse Response) filter like Low pass FIR filter, High pass FIR filter, Band pass FIR filter and Band stop FIR filter using Rectangular window using MATLAB.
Step 2: Perform low pass filter calculations
Step 3: Plot the output sequences
Step 2: Perform high pass filter calculations
Step 3: Plot the output sequences
Step 2: Perform band pass filter calculations
Step 3: Plot the output sequences
Step 2: Perform band stop filter calculations
Step 3: Plot the output sequences
PROGRAM:
clc;
clear all;
close all;
rp= input ('Enter the passband ripple ');
rs= input('Enter the stop band ripple ');
wp= input('Enter the passband frequency ');
ws=input('Enter the stopband frequency ');
fs=input('Enter the sampling frequency ');
w1=2*wp/fs;
w2=2*ws/fs;
[n,wn]=buttord(w1,w2,rp,rs);
[b,a]=butter(n,wn);
w=0: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);
title('IIR LPF');
ylabel('Gain(dB)');
xlabel('Normalised frequency');
subplot(2,1,2);
plot(om/pi,an);
ylabel('Phase(radians)');
xlabel('Normalised frequency');
OUTPUT:
Fig: IIR window Output
FOR MORE DETAILS CLICK HERE
To write a program for IIR(inite Impulse Response) filter like Low pass FIR filter, High pass FIR filter, Band pass FIR filter and Band stop FIR filter using Rectangular window using MATLAB.
ALGORITHM:
LOW PASS FILTER:
Step 1: Read the input sequenceStep 2: Perform low pass filter calculations
Step 3: Plot the output sequences
HIGH PASS FILTER:
Step 1: Read the input sequenceStep 2: Perform high pass filter calculations
Step 3: Plot the output sequences
BAND PASS FILTER:
Step 1: Read the input sequenceStep 2: Perform band pass filter calculations
Step 3: Plot the output sequences
BAND STOP FILTER:
Step 1: Read the input sequence Step 2: Perform band stop filter calculations
Step 3: Plot the output sequences
PROGRAM:
clc;
clear all;
close all;
rp= input ('Enter the passband ripple ');
rs= input('Enter the stop band ripple ');
wp= input('Enter the passband frequency ');
ws=input('Enter the stopband frequency ');
fs=input('Enter the sampling frequency ');
w1=2*wp/fs;
w2=2*ws/fs;
[n,wn]=buttord(w1,w2,rp,rs);
[b,a]=butter(n,wn);
w=0: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);
title('IIR LPF');
ylabel('Gain(dB)');
xlabel('Normalised frequency');
subplot(2,1,2);
plot(om/pi,an);
ylabel('Phase(radians)');
xlabel('Normalised frequency');
OUTPUT:
Fig: IIR window Output
FOR MORE DETAILS CLICK HERE
No comments:
Post a Comment