Program Coding:: All All 'Passband Frequency' 'Stopband Frequency'
Program Coding:: All All 'Passband Frequency' 'Stopband Frequency'
rp = input('passband gain');
rs = input('stopband gain');
[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');
[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
-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');
-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