0% found this document useful (0 votes)
5 views8 pages

Exp 4

The document outlines the design of IIR filters, specifically Butterworth and Chebyshev filters, using MATLAB scripts. It details the theory behind digital filters, the design methods including Bilinear Transformation and Impulse Invariant Transformation, and provides sample MATLAB code for implementing these designs. Additionally, it includes library functions for filter design and examples of filter design outputs.

Uploaded by

Venkatanathan. S
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)
5 views8 pages

Exp 4

The document outlines the design of IIR filters, specifically Butterworth and Chebyshev filters, using MATLAB scripts. It details the theory behind digital filters, the design methods including Bilinear Transformation and Impulse Invariant Transformation, and provides sample MATLAB code for implementing these designs. Additionally, it includes library functions for filter design and examples of filter design outputs.

Uploaded by

Venkatanathan. S
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/ 8

EX.

NO : 4 DESIGN OF IIR FILTER (Butterworth /Chebyshev)


DATE :

AIM:
To write a MATLAB Script to design a IIR Butterworth / Chebyshev low pass filter using
i. Bilinear Transformation
ii. Impulse Invariant Transformation
.
APPARATUS REQUIRED:
Computer with MATLAB software

THEORY:
A digital filter is a linear time invariant discrete time system. The digital filters are classified
into two, based on their lengths of impulse response
1. Finite Impulse response (FIR)
They are of non-recursive type and h [n] has finite number of samples
2. Infinite Impulse response (IIR)
h[n] has infinite number of samples. They are of recursive type. Hence, their transfer
function is of the form

H ( z )   h( n ) z  n
n 0

M 1
 bk Z  k
H (Z )  K  0
N 1
1  a jZ  j
j 1
BUTTERWORTH FILTER:
Low pass Analog Butterworth filters are all pole filters characterised by magnitude frequency
response by
1
H ( j ) 2 =
  
2N

1  
 c 
where N is the order of the filter and c is the cut-off frequency.
As N , the low pass filter is said to be ideal. All types of filters namely-Low pass, High
pass, Band pass and Band elimination filters can be derived from the Normalized Low pass
filter.

CHEBYSHEV FILTER:
There are two types of Chebyshev filters.
Type I are all-pole filters that exhibit equi-ripple behaviour in pass band and monotonic
characteristics in stop band.

15
Type II are having both poles and zeros and exhibit monotonic behavior in pass band and
equi-ripple behaviour in stop band. The zero lies on the imaginary axis.

The magnitude-squared function is given as


2 1
H ( j ) 
1   2C N
2
( / p )
 is the ripple parameter in pass band
CN(x) is the Nth order Chebyshev polynomial defined as
Cos( N cosh 1 x) , x 1

CN(x) = 
Cos( N cosh 1 x), x 1
The digital filters are designed from analog filters. The two widely used methods for
digitizing the analog filters include
1. Bilinear transformation
2. Impulse Invariant transformation

BILINEAR TRANSFORMATION:
DESIGN STEPS:
1. From the given specifications, find pre-warped analog frequencies using
2  
  tan 
T 2
2. Using the analog frequencies, find H(s) of the analog filter
2 1  Z 1
3. Substitute S   in the H(s) of Step:2
T 1  Z 1

IMPULSE INVARIANT TRANSFORMATION:


DESIGN STEPS:

1. Find the analog frequency using 𝛺 =
T
2. Find the transfer function of analog filter Ha(s)
3. Express the analog filter transfer function as a sum of single pole filters
4. Compute H(Z) of digital filter using the formula
N
Ck
H (Z )  
1  e TPk Z
1

k 1

LIBRARY FUNCTIONS:
butter: Butterworth digital and analog filter design.
[B, A] = butter (N,Wn) designs an Nth order Low pass digital Butterworth filter and
returns the filter coefficient vectors B (numerator) and A (denominator) in length

16
N+1. The coefficients are listed in descending powers of z. The cut-off frequency Wn
must be in the range 0.0 < Wn < 1.0, with 1.0 corresponding to half the sample rate.

butter (N,Wn,'s'),butter (N,Wn,'low','s'),butter (N,Wn,'high','s'),butter


(N,Wn,'pass','s')and butter (N,Wn,'stop','s')design analog Butterworth filters. In this
case, Wn is in [rad/s] and it can be greater than 1.0.

buttord: Butterworth filter order selection.


[N, Wn] = buttord (Wp, Ws, Rp, Rs) returns the order N of the lowest order digital
Butterworth filter that loses no more than Rp dB in the pass band and has at least Rs
dB of attenuation in the stop band. Wp and Ws are the pass band and stop band edge
frequencies, normalized from 0 to 1 (where 1 corresponds to pi radians/sample).
For example,

Lowpass: Wp = .1, Ws = .2
Highpass: Wp = .2, Ws = .1
Bandpass: Wp = [.2 .7], Ws = [.1 .8]
Bandstop: Wp = [.1 .8], Ws = [.2 .7]
buttord: also returns Wn, the Butterworth natural frequency (or) the "3 dB frequency" to be
used with BUTTER to achieve the specifications.

[N, Wn] = buttord (Wp, Ws, Rp, Rs, 's') does the computation for an analog filter, in which
case Wp and Ws are in radians/second. When Rp is chosen as 3 dB, the Wn in BUTTER is
equal to Wp in BUTTORD.

cheb1ord: Chebyshev Type I filter order selection.


[N, Wn] = cheb1ord (Wp, Ws, Rp, Rs) returns the order N of the lowest order digital
Chebyshev Type I filter that loses no more than Rp dB in the pass band and has at
least Rs dB of attenuation in the stop band. Wp and Ws are the pass band and stop
band edge frequencies, normalized from 0 to 1 (where 1 corresponds to pi
radians/sample). For example,

Lowpass: Wp = .1, Ws = .2
Highpass: Wp = .2, Ws = .1
Bandpass: Wp = [.2 .7], Ws = [.1 .8]
Bandstop: Wp = [.1 .8], Ws = [.2 .7]
cheb1ord also returns Wn, the Chebyshev natural frequency to use with cheby1 to
achieve the specifications.

[N, Wn] = cheb1ord (Wp, Ws, Rp, Rs, 's') does the computation for an analog filter,
in which case Wp and Ws are in radians/second.
cheby1: Chebyshev Type I digital and analog filter design.

17
[B,A] = cheby1 (N,R,Wn) designs an Nth order Low pass digital Chebyshev filter
with R decibels of peak-to-peak ripple in the pass band. cheby1 returns the filter
coefficient vectors B (numerator) and A (denominator) of length N+1. The cut-off
frequency Wn must be in the range 0.0 < Wn < 1.0, with 1.0 corresponding to half the
sample rate. Use R=0.5 as a starting point, if you are unsure about choosing R.

cheby1 (N,R,Wn,'s'), cheby1 (N,R,Wn,'low','s'), cheby1 (N,R,Wn,'high','s'), cheby1


(N,R,Wn,'pass','s') and cheby1 (N,R,Wn,'stop','s') design analog Chebyshev Type I
filters. In this case, Wn is in [rad/s] and it can be greater than 1.0.

angle : Phase angle.


Theta=angle (H) returns the phase angles, in radians, of a matrix with complex
elements.
freqs : Laplace-transform (s-domain) frequency response.
H = freqs(B,A,W) returns the complex frequency response vector H of the filter
B/A:

B(s) b (1)s nb-1 + b(2)s nb-2 + ... + b(nb)


H(s) = =
A(s) a(1)s na-1 + a(2)s na-2 + ... + a(na)

given the numerator and denominator coefficients in vectors B and A. The frequency
response is evaluated at the points specified in vector W (in rad/s). The magnitude
and phase can be graphed by calling freqs(B,A,W) with no output arguments.

tf: Transfer function


SYS = tf(NUM,DEN) creates a continuous-time transfer function SYS with
numerator(s) NUM and denominator(s) DEN. The output SYS is a tf object.

Impinvar: Impulse Invariant method for analog-to-digital filter conversion [bz,az] =


impinvar(b,a,fs) creates a digital filter with numerator and denominator coefficients bz and
az, respectively, whose impulse response is equal to the impulse response of the analog filter
with coefficients b and a, scaled by 1/fs. If you leave out the argument fs (or) specify fs as an
empty vector [ ], it takes the default value of 1 Hz.

Bilinear: Bilinear transformation method for analog-to-digital filter conversion. The bilinear
transformation is a mathematical mapping of variables. In digital filtering, it is a standard
method of mapping the s or analog plane into the z or digital plane. It transforms analog
filters, designed using classical filter design.

RESULT:

18
Experiment 4
DATE: 17.02.2025 REGISTER NUMBER: URK23EC1015

DESIGN OF IIR FILTER (Butterworth /Chebyshev)


1)Design of Butterworth filter using Impulse Invariant method:
Code:
clear;

close all;

ap=0.8;

as=0.2;

wp=0.2*pi;

ws=0.6*pi;

ap1=20*log(0.8);

as1=20*log(0.2);

T=2;

wp1=wp/T;

ws1=ws/T;

[N,wc]=buttord(wp1,ws1,ap1,as1);

[b,a]=butter(N,wc,'low','s');

% tf(b,a)

[B,A] = impinvar(b,a,1/T);

freqz(B,A)

Output:
2)Design of Butterworth filter using Bilinear method:
Code:
clc;

clear;

close all;

ap=0.8;

as=0.2;

wp=0.2*pi;

ws=0.6*pi;

ap1=20*log(ap);

as1=20*log(as);

T=1;

wp1=2/T*tan(wp*T/2);

ws1=2/T*tan(ws*T/2);

[N,wc]=buttord(wp1,ws1,ap1,as1,'s');

[b,a]=butter(N,wc,'low','s');

% tf(b,a);

[b,a] = bilinear(b,a,1/T);

freqz(b,a);

title('BILINEAR TRANSFORMATION');

Output:
3)Design of Chebyshev filter using Impulse Invariant method:
Code:
clc;

ap = 0.8;

as = 0.2;

wp = 0.2*pi;

ws = 0.6*pi;

Ap1 = 20*log10(ap);

As1 = 20*log10(as);

t = 1;

Wp1 = wp/t;

Ws1 = ws/t;

[N,Wc] = cheb1ord(Wp1, Ws1, Ap1, As1, 's');

[B,A] = cheby1(N, Wc, Wp1, 'low', 's');

% tf(B,A)

[b,a] = impinvar(B,A,1/t);

freqz(b,a)

title('CHEBYSHEV LOW PASS FILTER- impulse invariant')

Output:
4)Design of Chebyshev filter using Bilinear method:
Code:
clc;

clear;

close all;

Ap=0.8;

As=0.2;

Wp=0.2*pi;

Ws=0.6*pi;

T=1;

Ap1=20*log10(Ap);

As1=20*log10(As);

Wp1=(2/T)*tan(Wp*T/2);

Ws1=(2/T)*tan(Ws*T/2);

Rp=3;

[N,Wn]=cheb1ord(Wp1,Ws1,Rp,As1,'s');

[B,A]=cheby1(N,Rp,Wn,'low','s');

% tf(B,A)

[b,a]=bilinear(B,A,1/T);

freqz(b,a)

title('BILINEAR TRANSFORMATION USING CHEBYSHEV FILTER');

Output:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy