The Islamia University of Bahawalpur
University College of Engineering &Technology
Department of Electronic Engineering
LAB MANUAL SIGNAL AND SYSTEMS EE-311 5thSemester
LAB EXPERIMENT # 13
Performance Analysis of Basic Filters
Student Name: Abdul Rehman Roll No: 16ES08
Lab Instructor Signatures: Date:
OBJECTIVE:
• To study the performance of basic filters
• Elliptic filter
Elliptic filter:
Syntax:
[b,a] = ellip(n,Rp,Rs,Wp)
[b,a] = ellip(n,Rp,Rs,Wp,ftype)
[z,p,k] = ellip(___)
[A,B,C,D] = ellip(___)
[b,a] = ellip(n,Rp,Rs,Wp) returns the transfer function coefficients of an nthorder
lowpass digital elliptic filter with normalized passband edge frequency Wp. The resulting
filter has Rp decibels of peak-to-peak passband ripple and Rs decibels of stopband
attenuation down from the peak passband value.
[b,a] = ellip(n,Rp,Rs,Wp,ftype) designs a lowpass, highpass, bandpass, or
bandstop elliptic filter, depending on the value of ftype and the number of elements
of Wp. The resulting bandpass and bandstop designs are of order 2n.
1. Lowpass Elliptic Transfer Function
Example: Design a 6th-order lowpass elliptic filter with 5 dB of passband ripple, 40 dB
of stopband attenuation, and a passband edge frequency of 300 Hz, which, for data
sampled at 1000 Hz, corresponds to 0.6 rad/sample. Plot its magnitude and phase
responses. Use it to filter a 1000-sample random signal.
1
Code:
>> [b,a] = ellip(6,5,40,0.6);
freqz(b,a)
dataIn = randn(1000,1);
dataOut = filter(b,a,dataIn);
>>
Output:
2. Bandstop Elliptic Filter
Example: Design a 6th-order elliptic bandstop filter with normalized edge frequencies
of 0.2 and 0.6 rad/sample, 5 dB of passband ripple, and 50 dB of stopband
attenuation. Plot its magnitude and phase responses. Use it to filter random data.
Code:
[b,a] = ellip(3,5,50,[0.2 0.6],'stop');
freqs(b,a)
2
Output:
3. Highpass Elliptic Filter
Example: Design a 6th-order highpass elliptic filter with a passband edge frequency
of 300 Hz, which, for data sampled at 1000 Hz, corresponds to 0.6 rad/sample.
Specify 3 dB of passband ripple and 50 dB of stopband attenuation. Plot the magnitude
and phase responses. Convert the zeros, poles, and gain to second-order sections for
use by fvtool.
Code:
[z,p,k] = ellip(6,3,50,300/500,'high');
sos = zp2sos(z,p,k);
fvtool(sos,'Analysis','freq')
Output:
3
4. Bandpass Elliptic Filter
Example: Design a 20th-order elliptic bandpass filter with a lower passband frequency of 500
Hz and a higher passband frequency of 560 Hz. Specify a passband ripple of 3 dB, a stopband
attenuation of 40 dB, and a sample rate of 1500 Hz. Use the state-space representation. Design
an identical filter using designfilt.
Code:
>> [A,B,C,D] = ellip(10,3,40,[500 560]/750);
d = designfilt('bandpassiir','FilterOrder',20, ...
'PassbandFrequency1',500,'PassbandFrequency2',560, ...
'PassbandRipple',3, ...
'StopbandAttenuation1',40,'StopbandAttenuation2',40, ...
'SampleRate',1500);
sos = ss2sos(A,B,C,D);
fvt = fvtool(sos,d,'Fs',1500);
legend(fvt,'ellip','designfilt')
>>
Output:
4
Low Pass Filter:
A low-pass filter is a filter that passes signals with a frequency lower than a certain
cutoff frequency and attenuates signals with frequencies higher than the cutoff
frequency. The amount of attenuation for each frequency depends on the filter
design. The filter is sometimes called a highcut filter, or treble cut filter in audio
applications.
High Pass Filter:
A high-pass filter is an electronic filter that passes signals with a frequency higher than a certain
cutoff frequency and attenuates signals with frequencies lower than the cutoff frequency. The
amount of attenuation for each frequency depends on the filter design. The simple first-order
electronic high-pass filter shown in Figure 1 is implemented by placing an input voltage across
the series combination of a capacitor and a resistor and using the voltage across the resistor as
an output. The product of the resistance and capacitance (R×C) is the time constant.
5
TASK
Q) Design a 5th-order analog Butterworth lowpass filter with a cutoff frequency of 2 GHz.
Multiply by to convert the frequency to radians per second. Compute the frequency response
of the filter at 4096 points.
Code:
>> n = 5;
f = 2e9;
[zb,pb,kb] = butter(n,2*pi*f,'s');
[bb,ab] = zp2tf(zb,pb,kb);
[hb,wb] = freqs(bb,ab,4096);
plot(wb/(2e9*pi),mag2db(abs(hb)))
Output: