0% found this document useful (0 votes)
156 views7 pages

IIR Filter Design with Matlab Guide

This document provides instructions for designing different types of IIR filters using Matlab. It discusses IIR filters and their advantages over FIR filters. It then describes using Matlab routines like buttord, butter, ellipord and ellip to design Butterworth, elliptic and Chebyshev filters based on frequency domain specifications. The in-lab task involves designing a 5th order Butterworth bandpass filter with given passband and stopband edge frequencies and ripples. It also shows code examples for Butterworth filter design and the effect of increasing the ripple factor. The post-lab tasks involve designing elliptic and Chebyshev filters of specified types.

Uploaded by

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

IIR Filter Design with Matlab Guide

This document provides instructions for designing different types of IIR filters using Matlab. It discusses IIR filters and their advantages over FIR filters. It then describes using Matlab routines like buttord, butter, ellipord and ellip to design Butterworth, elliptic and Chebyshev filters based on frequency domain specifications. The in-lab task involves designing a 5th order Butterworth bandpass filter with given passband and stopband edge frequencies and ripples. It also shows code examples for Butterworth filter design and the effect of increasing the ripple factor. The post-lab tasks involve designing elliptic and Chebyshev filters of specified types.

Uploaded by

saba rasheed
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

INSTITUTE OF BIOMEDICAL ENGINEERING & TECHNOLOGY

LIAQUAT UNIVERSITY OF MEDICAL & HEALTH SCIENCES


JAMSHORO

Subject: Signal and System Year: 3rd, Semester5th

LAB HANDOUT- 12

Name: _________________________________ Roll No: ____________________

Score: __________ Signature of Tutor: ______________ Date:________________

To design Types of an IIR Filter

REQUIRED:
PC with Matlab

INTRODUCTION:

IIR filters are one of two primary types of digital filters used in Signal Processing applications
(the other type being FIR). “IIR” means “Infinite Impulse Response.”

The advantage of IIR filters over FIR filters is that IIR filters usually require fewer coefficients
to execute similar filtering operations, that IIR filters work faster, and require less memory
space. ... FIR filters are better suited for applications that require a linear phase response.

IIR filters can achieve a given filtering characteristic using less memory and calculations than a
similar FIR filter.

The primary advantage of IIR filters over FIR filters is that they typically meet a given set of
specifications with a much lower filter order than a corresponding FIR filter.

DESCRIPTION:

Matlab contains various routines for design and analyzing digital filter IIR. Most of these are part
of the signal processing tool box. A selection of these filters is listed below.
 Buttord (for calculating the order of filter)
 Butter (creates an IIR filter)
 Ellipord (for calculating the order of filter)
 Ellip (creates an IIR filter)
 Cheb lord (for calculating the order of filter)
 Cheyb1 (creates an IIR filter)

DESIGNING IIR FILTERS TO FREQUENCY DOMAIN SPECIFICATION:


 This toolbox provides order selection functions that calculate the minimum filter order
that meets a given set of requirements.

FILTER TYPE ORDER ESTIMATION FUNCTION


Butterworth [N, Wn]= buttord (Wp,Ws,Rp,Rs)
[B,A]=butter(N,Wn)
Chebyshev type I [N, Wn]= cheblord (Wp,Ws,Rp,Rs)
[B,A]=cheby1(N,Wn)

Chebyshev type II [n,Wn]=cheb2ord (Wp,Ws,Rp,Rs)

Elliptic [N, Wn]= ellipord (Wp,Ws,Rp,Rs)


[B,A]=ellip(N,Wn)

In the Filter Design & Analysis Tool dialog box, set the following filter options:

Option Values
Response Type Highpass
Design Method IIR Butterworth
Filter Order Specify order: 5
Units: Hz
Fs: 48000
Frequency Specifications
Fc: 10800

INLAB-TASK:

Design an IIR Butterworth filter, with pass band Edge is at 0.4 and 0.65, stop band edge at 0.3
and 0.75, Pass band Ripple is 1db stop band ripple is 40db show magnitude and Phase response.

PROCEDURE:

In order to design a filter, we have to use filter design and analysis tool in matlab. To open filter
design and analysis tool write “fdatool” in command Window
filter design and analysis tool window will appear on the screen.

Then according to given in Lab task, we have to select an IIR butterworth and select Band
Pass in Response type
Then in Frequency specifications, Set Units to the normalized (0 to 1), wstop1: 0.3, wpass1:
0.4, wpass2: 0.65, wstop2: 0.75.

Now in Magnitude specifications, set Unit to dB, Astop1: 40 Apass: 1 Astop2: 80

After setting the entire values now click on Design Filter at bottom of the window

You’ll have the Magnitude


Then click on the Phase response it’ll show the phase of the designed filter.

Example 1 : Code for designing Buttord and Butter Filter:


CODE:

fs=4000;
[n,w]=buttord(1000/2000,1200/4000,1,50);
[b,a]=butter(n,w);
figure(1)
freqz(b,a,512,fs);
figure(2)
[h,q]=freqz(b,a,512,fs);
plot(q,abs(h));
grid

OUTPUT:
1.4

1.2

0.8

0.6

0.4

0.2

0
0 200 400 600 800 1000 1200 1400 1600 1800 2000
M a g n it u d e (d B )

-100

-200

-300

-400
0 200 400 600 800 1000 1200 1400 1600 1800 2000
Frequency (Hz)
P h a s e (d e g re e s )

-200

-400

-600

-800

-1000
0 200 400 600 800 1000 1200 1400 1600 1800 2000
Frequency (Hz)

JUST TO UNDERSTAND:
INCREASE THE RIPPLE FACTOR AND SEE THE CHANGES IN THE RESPONSES:

CODE:

fs=4000;
[n,w]=buttord(1000/2000,1200/4000,1,500);
[b,a]=butter(n,w);
figure(1)
freqz(b,a,512,fs);
figure(2)
[h,q]=freqz(b,a,512,fs);
plot(q,abs(h));
grid
100

0
Magnitude (dB)

-100

-200

-300

-400
0 200 400 600 800 1000 1200 1400 1600 1800 2000
Frequency (Hz)

0
Phase (degrees)

-2000

-4000

-6000

-8000
0 200 400 600 800 1000 1200 1400 1600 1800 2000
Frequency (Hz)

1.a Design IIR Band Pass Filter and Band stop Filter (Butterworth)
1.b Design IIR High Pass Filter

POST LAB TASK:

1. Write the code for Elliptic along with its order, paste its output.
2. Write the code for ChebyShev filter along its order, paste its ouput.

Note: Perform the given post lab task with respect to low, high, passband and stop filter

Common questions

Powered by AI

MATLAB's filter design tool is preferred for educational purposes because it provides an interactive environment that visualizes digital filter designs in real time. Students can manipulate parameters and immediately see results in magnitude and phase responses, which aids understanding. This hands-on approach bridges theoretical knowledge with practical applications, enhancing comprehension of complex concepts in digital signal processing .

Increasing the ripple factor in a Butterworth filter affects both the damping and the steepness of the filter's transition bands. An increase in the ripple factor can make the passband or the stopband more oscillatory, which alters how the filter attenuates unwanted frequencies. Understanding these changes is significant because it helps in designing filters tailored to specific frequency response characteristics needed for different signal processing applications .

To design an IIR Butterworth bandpass filter using MATLAB’s fdatool, first open the tool by typing 'fdatool' in the command window. Select the IIR Butterworth filter and set the filter type to Bandpass. In Frequency specifications, set the normalized units (0 to 1) and input: wstop1: 0.3, wpass1: 0.4, wpass2: 0.65, wstop2: 0.75. Under Magnitude specifications, set the units to dB: Astop1: 40, Apass: 1, Astop2: 80. Click on 'Design Filter' to obtain the magnitude response, and then select the phase response to view the phase of the designed filter .

Phase response plots are significant in digital filter design as they display how the filter affects the phase of different frequency components of the input signal. This information is critical in applications where phase coherence must be maintained, such as in audio processing or communications. By analyzing phase response plots, designers can understand potential phase distortions and make necessary adjustments to the filter parameters to ensure the desired phase characteristics are met, ultimately affecting how accurately the filtered signal represents the original signal .

The Filter Design and Analysis Tool (fdatool) in MATLAB visualizes the designed filter's phase response by plotting it against frequency. Viewing the phase response is significant as it helps in understanding the filter's effect on the phase of the input signal. This is crucial in applications where phase distortion can alter the signal’s characteristics, such as in communication systems where phase information conveys essential data. By analyzing the phase plots, engineers can adjust parameters to meet specific phase criteria and ensure optimal filter performance .

IIR filters have several advantages over FIR filters in digital signal processing, primarily due to their efficiency. IIR filters require fewer coefficients to achieve similar filtering operations, enabling them to work faster and use less memory space than FIR filters. They also typically meet a given set of specifications with a much lower filter order compared to FIR filters, making them advantageous for applications where computational resources are limited .

The process of performing post lab tasks in MATLAB involves writing and testing code for different filter types, such as low pass, high pass, passband, and stop filters. For instance, you would write code for designing elliptic and Chebyshev filters, calculate their orders, and observe outputs. Performing these tasks is important because it consolidates theoretical understanding with practical application, enabling students to see how theoretical specifications translate into actual filter characteristics. This experiential learning is crucial for developing the skills necessary to approach real-world signal processing problems .

The magnitude response of an IIR Butterworth filter is characterized by its maximally flat passband, with no ripples, and a smooth transition to the stopband. Its importance lies in its clear filtering properties, providing an efficient attenuation of unwanted frequencies while maintaining a consistent passband. This feature makes Butterworth filters suitable for applications that require minimal signal distortion across the passband .

An FIR filter might be preferred over an IIR filter in scenarios where a linear phase response is critical, as FIR filters inherently provide this attribute. Applications requiring precise control over phase characteristics, such as data communications and audio processing, benefit from the linear phase of FIR filters. Furthermore, FIR filters are often chosen when numerical stability is a concern, as they are inherently stable regardless of filter order .

MATLAB provides specific functions used in the design of IIR filters: 'buttord' for calculating the order of a filter and 'butter' for creating the IIR Butterworth filter. Similarly, 'ellipord' and 'ellip' are used for elliptic filters, 'cheby1ord' and 'cheby1' for Chebyshev type I, and 'cheby2ord' for Chebyshev type II filters. These functions play a crucial role in determining the minimum number of coefficients necessary to meet specified filtering requirements, thereby optimizing the filter's performance and resource usage .

You might also like