0% found this document useful (0 votes)
88 views

Program Coding:: All All 'Passband Frequency' 'Stopband Frequency'

The document contains MATLAB code to design and analyze Chebyshev and Butterworth IIR filters using both bilinear transform and impulse invariant transform methods. The code generates magnitude and phase response plots of the designed filters for different filter types and transformations. Users can specify passband and stopband frequency and ripple parameters and the code outputs the filter coefficients and response plots.

Uploaded by

s.reegan
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
88 views

Program Coding:: All All 'Passband Frequency' 'Stopband Frequency'

The document contains MATLAB code to design and analyze Chebyshev and Butterworth IIR filters using both bilinear transform and impulse invariant transform methods. The code generates magnitude and phase response plots of the designed filters for different filter types and transformations. Users can specify passband and stopband frequency and ripple parameters and the code outputs the filter coefficients and response plots.

Uploaded by

s.reegan
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 6

PROGRAM CODING:

%IIR FILTER - CHEBYSHEV FILTER


clc;
clear all;
close all;
wp = input('passband frequency');
ws = input('stopband frequency');

rp = input('passband gain');
rs = input('stopband gain');

%IIR -chebyshev bilinear transform

[N,wn] = cheb1ord(wp,ws,rp,rs,'s');
[z,p,k] = cheb1ap(N,0.7648);
[num,den] = zp2tf(z,p,k);
[numt,dent] = lp2lp(num,den,wn);
[bz,az] = bilinear(numt,dent,1);
[b,w] = freqz(bz,az,512);
mag = 20*log10(abs(b));
subplot(2,2,1);
%plot(2,2,1)
plot(w/pi,mag),grid;
title('iir chebyshev bilinear transform 07ece52');
xlabel('normalised frequency')
ylabel('gain in db');
an=angle(b);
subplot(2,2,2);
plot(w/pi,an),grid;
xlabel('normalised frequency');
ylabel('phase in radian');

%IIR -chebyshev impulse invariant transform

[N,wn] = cheb1ord(wp,ws,rp,rs,'s');
[z,p,k] = cheb1ap(N,0.7648);
[num,den] = zp2tf(z,p,k);
[numt,dent] = lp2lp(num,den,wn);
[bz,az] = impinvar(numt,dent,1);
[h,w] = freqz(bz,az,5120);
mag = 20*log10(abs(h));
subplot(2,2,3);
plot(w/pi,mag),grid;
title('iir chebyshev impulse invariance 07ece52');
xlabel('normalised frequency')
ylabel('gain in db');
an=angle(h);
subplot(2,2,4);
plot(w/pi,an),grid;
xlabel('normalised frequency');
ylabel('phase in radian');
OUTPUT:
Passband freq: 0.3
Stopband freq: 0.7
Passband ripple: 0.5
Stopband freq: 10

iir chebyshev bilinear transform 07ece52


0 0

-1
-50
-2
-100
-3

-150 -4
0 0.5 1 0 0.5 1
normalised frequency normalised frequency
iir chebyshev impulse invariance 07ece52
0 0

-10 -1

-20 -2

-30 -3

-40 -4
0 0.5 1 0 0.5 1
normalised frequency normalised frequency
%IIR FILTER-BUTTERWORTH FILTER
clc;
clear all;
close all;
wp=input('passband freq');
ws=input('stopband freq');
%fs=input('sampling freq');
rp=input('passband ripple');
rs=input('stopband freq');
%w1=2*wp/fs;
%w2=2*ws/fs;
%IIR butterworth bilinear transform
[N,wn]=buttord(wp,ws,rp,rs,'s');
[z,p,k]=buttap(N);
[num,den]=zp2tf(z,p,k);
[numt,dent]=lp2lp(num,den,wn);
[bz,az]=bilinear(numt,dent,1);
[h,w]=freqz(bz,az,512);
mag=20*log10(abs(h));
subplot(2,2,1);
plot(w/pi,mag),grid;
title('iir butterworth bilinear transform 07ece52');
xlabel('normalized freq ');
ylabel('gain in Db');
an=angle(h);
subplot(2,2,2);
plot(w/pi,an),grid;
xlabel('normalized freq ');
ylabel('phase in radian');

%IIR butterworth impulse invariance transform


[N,wn]=buttord(wp,ws,rp,rs,'s');
[z,p,k]=buttap(N);
[num,den]=zp2tf(z,p,k);
[numt,dent]=lp2lp(num,den,wn);
[bz,az]=impinvar(numt,dent,1);
[h,w]=freqz(bz,az,512);
mag=20*log10(abs(h));
subplot(2,2,3);
plot(w/pi,mag),grid;
title('iir butterworth impulse invariance 07ece52');
xlabel('normalized freq ');
ylabel('gain in db');
an=angle(h);
subplot(2,2,4);
plot(w/pi,an),grid;
xlabel('normalized freq ');
ylabel('phase in radian');
OUTPUT:
Passband freq: 0.3
Stopband freq: 0.7
Passband ripple: 0.5
Stopband freq: 10

iir butterworth bilinear transform 07ece52


0 4

-50 2

-100 0

-150 -2

-200 -4
0 0.5 1 0 0.5 1
normalized freq normalized freq
iir butterworth impulse invariance 07ece52
0 4

2
-20
0
-40
-2

-60 -4
0 0.5 1 0 0.5 1
normalized freq normalized freq

You might also like