0% found this document useful (0 votes)
41 views21 pages

Experiment No. 6

The document describes the design and analysis of various analog and digital filters, including Butterworth, Chebyshev type-1, Chebyshev type-2, and Elliptic filters. It provides the order and cutoff frequency for the analog prototypes. It then converts each analog filter to the digital domain using impulse invariance and compares the frequency responses of the analog and digital filters.

Uploaded by

RaviKiran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views21 pages

Experiment No. 6

The document describes the design and analysis of various analog and digital filters, including Butterworth, Chebyshev type-1, Chebyshev type-2, and Elliptic filters. It provides the order and cutoff frequency for the analog prototypes. It then converts each analog filter to the digital domain using impulse invariance and compares the frequency responses of the analog and digital filters.

Uploaded by

RaviKiran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Experiment No.

6
1. Program:

clc; clearal l; close all;


rp = 1; %Pass- band r ipp le
rs = 20; %Stop- band attenuat ion
wp = 0.2*pi; %Frequency should be in rad/sec
ws = 0.3*pi;
% butterworth
[Nb,wcb] = buttord(wp,ws,rp,rs,'s'); %Getting the order N and the 3dB
cut- of f f req
[b1,a1] = butter(Nb,wcb,'s'); %Getting the numerator & denominator
ploynomial coef f s
[Hb,Wb] = freqs(b1,a1); %Complex f req . response of analog f i l t e r
subplot(311);
plot(Wb,20*log10(abs(Hb))), grid on;
title('Frequency Response-Butterworth');
xlabel(' Frequency in rad/s '),ylabel(' Magnitude in dB ');
disp('The order and cut off frequency are '),disp( Nb),disp( wcb);
% Chebyshev
[Nc,wcc] = cheb1ord(wp,ws,rp,rs,'s');
[b2,a2] = cheby1(Nc,rp,wcc,'s');
[Hc,Wc] = freqs(b2,a2); % f req . response
subplot(312);
plot(Wc,20*log10(abs(Hc))),grid on;
title('Frequency Response-Chebyshev');
xlabel('Frequency in rad/s'), ylabel('Magnitude in dB');
disp('The order and cut-off frequency are '),disp( Nc), disp(wcc);
% Elliptic
[Ne,wce] = ellipord(wp,ws,rp,rs,'s');
[b3,a3] = ellip(Ne,rp,rs,wce,'s');
[He,We] = freqs(b3,a3); % f req . response
subplot(313);
plot(We,20*log10(abs(He))),grid on;
title('Frequency Response-Elliptic');
xlabel('Frequency in rad/s'), ylabel('Magnitude in dB');
disp('The order and cut-off frequency are '),disp( Ne), disp(wce);
Output:
The order and cut off frequency for Butterworth are

8
0.7072
The order and cut-off frequency for Chebyshev-1 are
4
0.6283
The order and cut-off frequency for Elliptic are
3

Magnitude in db

Magnitude in db

Magnitude in dB

0.6283
Frequency Response-Butterworth
200
0
-200

4
5
6
7
Frequency in rad/s
Frequency Response-Chebyshev

10

10

10

0
-100
-200

4
5
6
7
Frequency in rad/s
Frequency Response-Elliptic

0
-50
-100

2. Program:

clc, clear al l, close


all;
Fs = 150;
% Filter design
%--------------fp = [29 31]; % Assumed

4
5
6
Frequency in rad/s

fs = [25 35]%; Assumed


wp = fp*2/Fs;
ws = fs*2/Fs;
rp = 1;% Assumed
rs = 40;% Assumed
% Butterworth
[Nb,wcb] = buttord(wp,ws,rp,rs);
[bb,ab] = butter(Nb,wcb);
[Hb,Fb] = f reqz (bb ,ab ,512,Fs
% )f ;req . response
figure(1);
subplot(311), plot(Fb,20*log10(abs(Hb))),grid on;
title('F requency Response of Butterworth Fi
) ;l t e r '
disp('For Butterworth , the order and cut of f f requency )in
, Hz are '
disp( Nb),disp(wcb*Fs/2);
% Chebyshev
[Nc,wcc] = cheb1ord(wp,ws,rp,rs);
[bc,ac] = cheby1(Nc,rp,wcc);
[Hc,Fc ] = f reqz (bc ,ac ,512 ,Fs
% f)req
; . response
subplot(312), plot(Fc,20*log10(abs(Hc))),grid on;
title('F requency response of Chebyshev Fi)l;t e r '
ylabel('Magni tude in dB'
);
disp('For Chebyshev the order and cut- of f f requency in Hz are
') ,d i sp ( Nc) , disp(wcc*Fs /2 ) ;
% Elliptic
[Ne,wce] = ellipord(wp,ws,rp,rs);
[be,ae] = ellip(Ne,rp,rs,wce);
[He,Fe] = f reqz (be ,ae ,512,Fs
% )f req
;
. response
subplot(313), plot(Fe,20*log10(abs(He))),grid on;
title('F requency response of El l i p t i c ) ;Fi l t e r '
xlabel('F requency in Hz'
);
disp('For El l i p t i c the order and cut- of f f requency) ,d
ini sp
Hz( are
Ne),'
disp(wce*Fs /2 ) ;
% Simulating given signal
%-------------------------t = 0:1/Fs:0.5;
x = sin(2*pi*t*10)+sin(2*pi*t*30)+sin(2*pi*t*50);
figure(2);
subplot(411), plot(t,x);
title('T ime domain plot of input signa
);
l'
% Filter testing
%----------------yb = f i l t e r ( bb ,ab ,x
%fi
) ;l te r the s igna l using Butterworth f i l t e r
yc = f i l t e r ( b c , ac%fi
, x ) l;te r the s igna l using Chebyshev f i l t e r
ye = f i l t e r ( be ,ae %fi
,x ) ;l te r the s igna l using El l i p t i c f i l t e r

subplot(412), plot(t,yb);
title('T ime domain plot of Butterworth f i l t e r ed) ; s igna l '
subplot(413), plot(t,yc);
title('T ime domain plot of Chebyshev f i l t e r ed ) signa
;
l'
subplot(414), plot(t,ye);
title('T ime domain plot of El l i p t i c f i l t e r ed
) ; signa l '
xlabel(' t ime- - - - - )-;- >'
% Get spectrum and plot
N = 512;
w = [0:N/2 - 1]*(Fs /N%defin
);
ing f requency vector for plot t i ng
X = fft(x,N);
Yb = fft(yb,N);
Yc = fft(yc,N);
Ye = fft(ye,N);
figure(3);
subplot(411), plot(w,abs(X(1:N/2)));
title('Spect rum of input signa
); l '
subplot(412), plot(w,abs(Yb(1:N/2)));
title('Spect rum of Butterworth f i l t e r ed ) ;signa l '
subplot(413), plot(w,abs(Yc(1:N/2)));
title('Spect rum of Chebyshev f i l t e r ed signa
);
l'
subplot(414), plot(w,abs(Ye(1:N/2)));
title('Spect rum of El l i p t i c f i l t e r ed) ; signa l '
xlabel('F requency in Hz'
);
Output:
For Butterworth, the order and cut off frequency in Hz are
4
28.4574 31.5617
For Chebyshev the order and cut-off frequency in Hz are
3
29

31

For Elliptic the order and cut-off frequency in Hz are


3
29

31

Frequency Response of Butterworth Filter


0
-200
-400
0

10

20

30

40

50

60

70

80

70

80

70

80

Magnitude in dB

Frequency response of Chebyshev Filter


0
-200
-400

10

20

30

40

50

60

Frequency response of Elliptic Filter


0
-200
-400

10

20

30
40
50
Frequency in Hz

60

Time domain plot of input signal


5
0
-5

0.05

0.1
0.15
0.2
0.25
0.3
0.35
0.4
Time domain plot of Butterworth filtered signal

0.45

0.5

0.05

0.1
0.15
0.2
0.25
0.3
0.35
0.4
Time domain plot of Chebyshev filtered signal

0.45

0.5

0.05

0.1

0.45

0.5

0.05

0.1

0.45

0.5

2
0
-2
1
0
-1

0.15
0.2
0.25
0.3
0.35
0.4
Time domain plot of Elliptic filtered signal

1
0
-1

0.15

0.2

0.25
0.3
time------->

0.35

0.4

Spectrum of input signal


40
20
0

10

20
30
40
50
60
Spectrum of Butterworth filtered signal

70

80

10

20
30
40
50
60
Spectrum of Chebyshev filtered signal

70

80

10

20

70

80

10

20

70

80

20
10
0
10
5
0

30
40
50
60
Spectrum of Elliptic filtered signal

20
10
0

30
40
50
Frequency in Hz

60

3. Program:

clc;
clear al l;
close al l;
d = [1 1]%Numerator
;
polynomial in s of analog f i l t e r
c = [1 5 6]
%Denominator
;
polynomial in s of analog f i l t e r
T = 0.1;
%Sampling t ime
[r,pa,k] = residue(d,c);
disp('Po les of analog f i)l;t e r '
disp(pa');
pd = exp(pa*T);
[b,a] = residuez(r,pd,k);
disp('Numerator polynomial in z^(- 1) of dig i ta
) ;l f i l t e r '
disp(b);
disp('Denominator polynomial in z^(- 1) of dig i ta
) ;l f i l t e r '
disp(a);
% Impulse response & magnitude response
[hd,n] = impz(b,a);
subplot(211),stem(n*T,hd), hold on;
plot(n*T,hd,' r )' , t i t l 'Impulse
e(
responses');
xlabel('Time in seconds');

ylabel('Ampl i tude)';
h = legend('D ig i t a l Fi l,'Analog
ter '
filter','Best');
set(h,'Interpreter','none')
[Hd,fd] = freqz(b,a,1/T);
[Ha,fa] = freqs(d,c,1/T);
subplot(212), plot(fd,abs(Hd));
hold on, plot(fa,abs(Ha),'r');
title('Frequency responses');
xlabel('Frequency in Hz');
ylabel('Magnitude');
h = legend('Digital Filter','Analog filter','Best');
set(h,'Interpreter','none');
Output:
Poles of analog filter
-3.0000 -2.0000
Numerator polynomial in z^(-1) of digital filter
1.0000 -0.8966
Denominator polynomial in z^(-1) of digital filter
1.0000 -1.5595

0.6065

Impulse responses

Amplitude

1
Digital Filter
Analog filter

0.5
0

-0.5

0.5

1.5

2
2.5
3
Time in seconds
Frequency responses

3.5

4.5

Magnitude

3
Digital Filter
Analog filter

2
1
0

4
5
6
Frequency in Hz

4. Program:

clc, clear al l, close


all;
% Digital Filter specification
wp = 0.2*pi;
ws = 0.3*pi;
rp = 1;
rs = 15;
% Analog prototype
T = 1; % Assumed
wa_p = wp/T;
wa_s = ws/T;
% Butterworth
[Nb,wcb] = buttord(wa_p,wa_s,rp,rs,'s');
[bb_s,ab_s] = butter(Nb,wcb,'s');
disp('For Butterworth, the order and cut off frequency are '),
disp( Nb),disp(wcb);
[Hb,wb] = freqs(bb_s,ab_s); % Analog f req . response
[bb_z,ab_z] = impinvar(bb_s,ab_s,1/T);
[Hbd,wbd] = freqz(bb_z,ab_z); % Digi ta l f req . response

10

figure(1);
subplot(211), plot(wbd/pi,20*log10(abs(Hbd))),grid on;
ylabel('Magni tude in dB'
);
xlabel('F requency in pi uni
) ; ts '
subplot(212),plot(wbd/pi,angle(Hbd)/pi),grid on;
xlabel('F requency in pi uni
) ; ts '
ylabel('p i uni ts
); '
% Chebyshev type-1
[Nc1,wcc1] = cheb1ord(wa_p,wa_s,rp,rs,' s ') ;
[bc1_s,ac1_s] = cheby1(Nc1,rp,wcc1,' s ') ;
disp('For Chebyshev- 1, the order and cut of f f requency
),
are '
disp( Nc1),disp(wcc1);
[Hc1,wc1] = f reqs(bc1_s ,ac1_s
%)f;req . response
[bc1_z,ac1_z] = impinvar(bc1_s,ac1_s,1/T);
[Hc1d,wc1d] = f reqz (bc1_z ,ac1_z
%)Digi
;
ta l f req . response
figure(2);
subplot(211), plot(wc1d/pi,20*log10(abs(Hc1d))),grid on;
ylabel('Magni tude in dB'
);
xlabel('F requency in pi uni
) ; ts '
subplot(212),plot(wc1d/pi,angle(Hc1d)/pi),grid on;
ylabel('p i uni ts
); '
xlabel('F requency in pi uni
) ; ts '
% Chebyshev type-2
[Nc2,wcc2] = cheb2ord(wa_p,wa_s,rp,rs,' s ') ;
[bc2_s,ac2_s] = cheby2(Nc2,rs,wcc2,' s ') ;
disp('For Chebyshev- 2, the order and cut of f f requency
),
disp( Nc2),disp(wcc2);
[Hc2,wc2] = f reqs(bc2_s ,ac2_s
%)f;req . response
[bc2_z,ac2_z] = impinvar(bc2_s,ac2_s,1/T);
[Hc2d,wc2d] = f reqz (bc2_z ,ac2_z
%)Digi
;
ta l f req . response

are '

figure(3);
subplot(211), plot(wc2d/pi,20*log10(abs(Hc2d))),grid on;
ylabel('Magni tude in dB'
);
xlabel('F requency in pi uni
) ; ts '
subplot(212),plot(wc2d/pi,angle(Hc2d)/pi),grid on;
ylabel('p i uni ts
); '
xlabel('F requency in pi uni
) ; ts '
% Elliptic
[Ne,wce] = ellipord(wa_p,wa_s,rp,rs,' s ') ;
[be_s,ae_s] = ellip(Ne,rp,rs,wce,' s ') ;
disp('For El l i p t i c , the order and cut of f f requency
),

are '

disp( Ne),disp(wce);
[He,we] = f reqs (be_s ,ae_s
%) f; req . response
[be_z,ae_z] = impinvar(be_s,ae_s,1/T);
[Hed,wed] = f reqz(be_z ,ae_z
%) Digi
;
ta l f req . response
figure(4);
subplot(211), plot(wed/pi,20*log10(abs(Hed))),grid on;
ylabel('Magni tude in dB'
);
xlabel('F requency in pi uni
) ; ts '
subplot(212),plot(wed/pi,angle(Hed)/pi),grid on;
ylabel('p i uni ts
); '
xlabel('F requency in pi uni
) ; ts '
Output:
For Butterworth, the order and cut off frequency are
6
0.7087
For Chebyshev-1, the order and cut off frequency are
4
0.6283
For Chebyshev-2, the order and cut off frequency are
4
0.8236
For Elliptic, the order and cut off frequency are
3
0.6283

Butterworth
Magnitude in dB

0
-20
-40
-60
-80

0.1

0.2

0.3

0.4
0.5
0.6
Frequency in pi units

0.7

0.8

0.9

0.1

0.2

0.3

0.4
0.5
0.6
Frequency in pi units

0.7

0.8

0.9

pi units

0.5
0
-0.5
-1

Chebyshev-1
Magnitude in dB

50
0
-50

-100

0.1

0.2

0.3

0.4
0.5
0.6
Frequency in pi units

0.7

0.8

0.9

0.1

0.2

0.3

0.4
0.5
0.6
Frequency in pi units

0.7

0.8

0.9

pi units

0.5
0
-0.5
-1

Chebyshev-2
Magnitude in dB

5
0
-5
-10
-15

0.1

0.2

0.3

0.4
0.5
0.6
Frequency in pi units

0.7

0.8

0.9

0.1

0.2

0.3

0.4
0.5
0.6
Frequency in pi units

0.7

0.8

0.9

pi units

0.5
0
-0.5
-1

Elliptic
Magnitude in dB

10
0
-10
-20
-30

0.1

0.2

0.3

0.4
0.5
0.6
Frequency in pi units

0.7

0.8

0.9

0.1

0.2

0.3

0.4
0.5
0.6
Frequency in pi units

0.7

0.8

0.9

pi units

0.5
0
-0.5
-1

5. Program:

clc;
clear al l;
close al l;
d = [1 1]%Numerator
;
polynomial in s of analog f i l t e r
c = [1 5 6]
%Denominator
;
polynomial in s of analog f i l t e r
T = 1;%Sampling t ime
[b,a] = bilinear(d,c,1/T);
disp('D ig i t a l f i l t e r numerator )coef
;
fs '
disp(b);
disp('D ig i t a l f i l t e r denominator )coef
;
fs '
disp(a);
Output:
Digital filter numerator coeffs
0.1500

0.1000 -0.0500

Digital filter denominator coeffs


1.0000

0.2000 -0.0000

6. Program:

clc, clear al l, close


all;
% Digital Filter specification
wp = 0.2*pi;
ws = 0.3*pi;
rp = 1;
rs = 15;
% Analog prototype
T = 1; % Assumed
wa_p = wp/T;
wa_s = ws/T;
% Butterworth
[Nb,wcb] = buttord(wa_p,wa_s,rp,rs,'s');
[bb_s,ab_s] = butter(Nb,wcb,'s');
disp('For Butterworth, the order and cut off frequency are '),

disp( Nb),disp(wcb);
[Hb,wb] = f reqs(bb_s ,ab_s
%) ;Analog f req . response
[bb_z,ab_z] = bilinear(bb_s,ab_s,1/T);
[Hbd,wbd] = f reqz(bb_z ,ab_z
%) ;Dig i ta l f req . response
figure(1);
subplot(211), plot(wbd/pi,20*log10(abs(Hbd))),grid on;
ylabel('Magni tude in dB'
);
xlabel('F requency in pi uni
) ;t s '
title('But te rwor th) ;'
subplot(212),plot(wbd/pi,angle(Hbd)/pi),grid on;
xlabel('F requency in pi uni
) ;t s '
ylabel('p i uni ts
); '
% Chebyshev type-1
[Nc1,wcc1] = cheb1ord(wa_p,wa_s,rp,rs,'s ') ;
[bc1_s,ac1_s] = cheby1(Nc1,rp,wcc1,'s ') ;
disp('For Chebyshev- 1, the order and cut of f f requency
),
are '
disp( Nc1),disp(wcc1);
[Hc1,wc1] = f reqs(bc1_s ,ac1_s
%)f;req . response
[bc1_z,ac1_z] = bilinear(bc1_s,ac1_s,1/T);
[Hc1d,wc1d] = f reqz(bc1_z ,ac1_z
%)Dig
; i ta l f req . response
figure(2);
subplot(211), plot(wc1d/pi,20*log10(abs(Hc1d))),grid on;
ylabel('Magni tude in dB'
);
xlabel('F requency in pi uni
) ;t s '
title('Chebyshev- 1'
);
subplot(212),plot(wc1d/pi,angle(Hc1d)/pi),grid on;
ylabel('p i uni ts
); '
xlabel('F requency in pi uni
) ;t s '
% Chebyshev type-2
[Nc2,wcc2] = cheb2ord(wa_p,wa_s,rp,rs,'s ') ;
[bc2_s,ac2_s] = cheby2(Nc2,rs,wcc2,'s ') ;
disp('For Chebyshev- 2, the order and cut of f f requency
),
are '
disp( Nc2),disp(wcc2);
[Hc2,wc2] = f reqs(bc2_s ,ac2_s
%)f;req . response
[bc2_z,ac2_z] = bilinear(bc2_s,ac2_s,1/T);

[Hc2d,wc2d] = f reqz(bc2_z ,ac2_z


%)Dig
; i ta l

f req . response

figure(3);
subplot(211), plot(wc2d/pi,20*log10(abs(Hc2d))),grid on;
ylabel('Magni tude in dB'
);
xlabel('F requency in pi uni
) ;t s '
title('Chebyshev- 2'
);
subplot(212),plot(wc2d/pi,angle(Hc2d)/pi),grid on;
ylabel('p i uni ts
); '
xlabel('F requency in pi uni
) ;t s '
% Elliptic
[Ne,wce] = ellipord(wa_p,wa_s,rp,rs,'s ') ;
[be_s,ae_s] = ellip(Ne,rp,rs,wce,'s ') ;
disp('For El l i p t i c , the order and cut of f f requency
),
are '
disp( Ne),disp(wce);
[He,we] = f reqs(be_s ,ae_s
%) f; req . response
[be_z,ae_z] = bilinear(be_s,ae_s,1/T);
[Hed,wed] = f reqz(be_z ,ae_z
%) Dig
; i ta l f req . response
figure(4);
subplot(211), plot(wed/pi,20*log10(abs(Hed))),grid on;
ylabel('Magni tude in dB'
);
xlabel('F requency in pi uni
) ;t s '
title('E l l i p t )i c
;'
subplot(212),plot(wed/pi,angle(Hed)/pi),grid on;
ylabel('p i uni ts
); '
xlabel('F requency in pi uni
) ;t s '
Output:
For Butterworth, the order and cut off frequency are
6
0.7087
For Chebyshev-1, the order and cut off frequency are
4
0.6283

For Chebyshev-2, the order and cut off frequency are


4
0.8236
For Elliptic, the order and cut off frequency are
3
0.6283
Butterworth
Magnitude in dB

200
0
-200

-400

0.1

0.2

0.3

0.4
0.5
0.6
Frequency in pi units

0.7

0.8

0.9

0.1

0.2

0.3

0.4
0.5
0.6
Frequency in pi units

0.7

0.8

0.9

pi units

0.5
0
-0.5
-1

Chebyshev-1
Magnitude in dB

0
-100
-200

-300

0.1

0.2

0.3

0.4
0.5
0.6
Frequency in pi units

0.7

0.8

0.9

0.1

0.2

0.3

0.4
0.5
0.6
Frequency in pi units

0.7

0.8

0.9

pi units

0.5
0
-0.5
-1

Chebyshev-2
Magnitude in dB

-50

-100

0.1

0.2

0.3

0.4
0.5
0.6
Frequency in pi units

0.7

0.8

0.9

0.1

0.2

0.3

0.4
0.5
0.6
Frequency in pi units

0.7

0.8

0.9

pi units

0.5
0
-0.5
-1

Elliptic
Magnitude in dB

0
-20
-40
-60
-80

0.1

0.2

0.3

0.4
0.5
0.6
Frequency in pi units

0.7

0.8

0.9

0.1

0.2

0.3

0.4
0.5
0.6
Frequency in pi units

0.7

0.8

0.9

pi units

0.5
0
-0.5
-1

7. Program:

clc, clear al l, close


all;
% Filter specification
rp = 1;
rs = 30;
wa_p = 30;
wa_s = 40;
Fs = 100/(2*pi); % Assumed sampl ing rate
[Nb,wcb] = buttord(wa_p,wa_s,rp,rs,'s');
[bb_s,ab_s] = butter(Nb,wcb,'s');
disp('The order and cut off frequency are '),
disp( Nb),disp(wcb);
[Hb,wb] = freqs(bb_s,ab_s); % Analog f req . response
[bb_zi,ab_zi] = impinvar(bb_s,ab_s,Fs);
[bb_zb,ab_zb] = bilinear(bb_s,ab_s,Fs);
[Hbdi,wbdi] = freqz(bb_zi,ab_zi);
[Hbdb,wbdb] = freqz(bb_zb,ab_zb);
subplot(221), plot(wbdi/pi,20*log10(abs(Hbdi))),grid on;
ylabel('Magnitude in dB');
xlabel('Frequency in pi units');
title('Impulse invariance');
subplot(223),plot(wbdi/pi,angle(Hbdi)/pi),grid on;
xlabel('Frequency in pi units');
ylabel('pi units');
subplot(222), plot(wbdb/pi,20*log10(abs(Hbdb))),grid on;
ylabel('Magnitude in dB');
xlabel('Frequency in pi units');
title('Bilinear');
subplot(224),plot(wbdb/pi,angle(Hbdb)/pi),grid on;
xlabel('Frequency in pi units');
ylabel('pi units');
Output:
The order and cut off frequency are

15
31.7742
Impulse invariance

Bilinear
Magnitude in dB

100

0
-50

-100

0.5
Frequency in pi units

0
-100
-200
-300

0.5

0.5

pi units

pi units

Magnitude in dB

50

0
-0.5
-1

0.5
Frequency in pi units

0.5
Frequency in pi units

0
-0.5

0.5
Frequency in pi units

-1

8. Program:

clc, close al l, clear


all;
N = 3;
fc = 500;
wc = 2*pi*fc;
T = 0.1;
[b,a] = butter(N,wc,'high','s');
[bzb azb] = bilinear(b,a,1/T);
[bzi azi] = impinvar(b,a,1/T);
[H w] = freqs(b,a);
[Hb wb] = freqz(bzb,azb);
[Hi wi] = freqz(bzi,azi);
subplot(311),plot(w/(2*pi),20*log10(abs(H)));
title('Analog filter');
subplot(312),plot(wb/(pi*2*T),20*log10(abs(Hb)));

title('B i l i n ea)r; '


subplot(313),plot(wi/(pi*2*T),20*log10(abs(Hi)));
title(' Impulse invar i an
) ;t '
Analog filter
0
-200
-400

200

400

600

800

1000

1200

1400

1600

Bilinear
0
-200
-400

0.5

1.5

2.5

3.5

4.5

3.5

4.5

Impulse invariant
58
56
54

0.5

1.5

2.5

You might also like