You are on page 1of 3

Electronics and Telecommunication Engineering, FAMT Ratnagiri

Roll No.
Name:

Experiment No. 8 IIR Filter design using Bilinear Transformation

Aim
To learn IIR Filter design using Bilinear Transformation

Software/
Online platform Spyder(Python 3.8)
used

Theory: 1. Write steps of IIR filter Design using BLT and Butterworth approximation.

2. Design IIR LPF with BLT and Butterworth approximation using following specifications

 Sampling rate of 40 kHz

 Pass band edge frequency of 4 kHz

 Stop band edge frequency of 8kHz

 Pass band ripple of 3dB

 Minimum stop band attenuation of 15 dB Butterworth LPF using BLT

3.Verify order N analytically and by program

#Design of IIR Filter


Code #The specifications Butterworth LPF using BLT are as follows:

# Sampling rate of 40 kHz


# Pass band edge frequency of 4 kHz
# Stop band edge frequency of 8kHz
# Pass band ripple of 3dB
# Minimum stop band attenuation of 15 dB
#Step 1: Importing all the necessary libraries.
# import required modules
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
import math

#Step 2: Define variables with the given specifications of the filter.


# Specifications of Filter

# sampling frequency
f_sample = 20000

# pass band frequency

Discrete Time Signal Processing Lab ECL502 1


Electronics and Telecommunication Engineering, FAMT Ratnagiri

f_pass = 4000

# stop band frequency


f_stop = 8000

# # pass band ripple


fs = 0.5

# pass band freq in radian


wp = f_pass/(f_sample/2)

# stop band freq in radian


ws = f_stop/(f_sample/2)

# Sampling Time
Td = 1

# pass band ripple


g_pass = 3

# stop band attenuation


g_stop = 15

#Step3: Building the filter using signal.buttord function.


# Conversion to prewrapped analog frequency
omega_p = (2/Td)*np.tan(wp/2)
omega_s = (2/Td)*np.tan(ws/2)

# Design of Filter using signal.buttord function


N, Wn = signal.buttord(omega_p, omega_s, g_pass, g_stop, analog=True)

# Printing the values of order & cut-off frequency!


print("Order of the Filter=", N) # N is the order
# Wn is the cut-off freq of the filter
print("Cut-off frequency= {:.3f} rad/s ".format(Wn))

# Conversion in Z-domain

# b is the numerator of the filter & a is the denominator


b, a = signal.butter(N, Wn, 'low', True) #TF of anlogLPF
z, p = signal.bilinear(b, a, fs) #TF of digital LPF
# w is the freq in z-domain & h is the magnitude in z-domain
w, h = signal.freqz(z, p, 512)

#Step 4: Plotting the Magnitude Response.

Discrete Time Signal Processing Lab ECL502 2


Electronics and Telecommunication Engineering, FAMT Ratnagiri

# Magnitude Response
plt.semilogx(w, 20*np.log10(abs(h)))
plt.xscale('log')
plt.title('Butterworth filter frequency response')
plt.xlabel('Frequency [Hz]')
plt.ylabel('Amplitude [dB]')
plt.margins(0, 0.1)
plt.grid(which='both', axis='both')
plt.axvline(100, color='green')
plt.show()
Output:
Order of the Filter= 3
Cut-off frequency= 0.406 rad/s

Conclusion 1. In this experiment, we have learned to design IIR filter using Bilinear
transformation and Butterworth approximation.
2. The order N by program and analytically is same.
Test your 1. What is warping effect in BLT? And need of pre-warping?
understanding 2. Difference between Butterworth and Chebyshev filter characteristics.
3. Design steps of Butterworth and Chebyshev filter using Bilinear transformation .

Discrete Time Signal Processing Lab ECL502 3

You might also like