Assignment 2 and Submission Guidelines
School School of Information Technology and Engineering
Course Name Master of Engineering (Telecommunications)
Unit Code ME606
Unit Title Digital Signal Processing
Assessment Author Dr. Reza Berangi
Assessment Type Assignment 2 (Individual)
Assessment Title z-Transforms, Filters Concepts
Unit Learning
Outcomes covered
in this assessment
a. Develop and implement signal processing algorithms in Matlab
. Undertake in-depth design of digital filters
Weight 15%
Total Marks 100
Word/page limit N/A
Release Date Week 7
Due Date Week XXXXXXXXXXMay 2019, 11:55 pm)
Submission
Guidelines
• All work must be submitted on Moodle by the due date along with a completed
Assignment Cover Page.
• The assignment must be in MS Word format, single line spacing, 11-pt Cali
i
(Body) font and 2 cm margins on all four sides of your page with appropriate
section headings.
• Reference sources must be cited in the text of the report, and listed appropriately
at the end in a reference list using IEEE referencing style for School of Business and
School of Information Technology and Engineering respectively.
Extension If an extension of time to submit work is required, a Special Consideration
Application must be submitted directly through the AMS. You must submit this
application three working days prior to the due date of the assignment. Further
information is available at:
http:
www.mit.edu.au/about-mit/institute-publications/policies-proceduresand-
guidelines/specialconsiderationdeferment
Academic
Misconduct
Academic Misconduct is a serious offence. Depending on the seriousness of the
case, penalties can vary from a written warning or zero marks to exclusion from
the course or rescinding the degree. Students should make themselves familiar
with the full policy and procedure available at:
http:
www.mit.edu.au/aboutmit/institute-publications/policies-procedures-
and-guidelines/PlagiarismAcademic-Misconduct-Policy-Procedure. For further
information, please refer to the Academic Integrity Section in your Unit
Description.
http:
www.mit.edu.au/about
http:
www.mit.edu.au/about
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/special-considerationdeferment
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/special-considerationdeferment
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/special-considerationdeferment
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/special-considerationdeferment
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/special-considerationdeferment
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/special-considerationdeferment
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/special-considerationdeferment
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/special-considerationdeferment
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/special-considerationdeferment
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/special-considerationdeferment
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/special-considerationdeferment
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/special-considerationdeferment
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/special-considerationdeferment
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/special-considerationdeferment
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/special-considerationdeferment
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/special-considerationdeferment
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/special-considerationdeferment
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/special-considerationdeferment
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/special-considerationdeferment
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/Plagiarism-Academic-Misconduct-Policy-Procedure
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/Plagiarism-Academic-Misconduct-Policy-Procedure
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/Plagiarism-Academic-Misconduct-Policy-Procedure
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/Plagiarism-Academic-Misconduct-Policy-Procedure
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/Plagiarism-Academic-Misconduct-Policy-Procedure
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/Plagiarism-Academic-Misconduct-Policy-Procedure
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/Plagiarism-Academic-Misconduct-Policy-Procedure
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/Plagiarism-Academic-Misconduct-Policy-Procedure
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/Plagiarism-Academic-Misconduct-Policy-Procedure
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/Plagiarism-Academic-Misconduct-Policy-Procedure
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/Plagiarism-Academic-Misconduct-Policy-Procedure
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/Plagiarism-Academic-Misconduct-Policy-Procedure
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/Plagiarism-Academic-Misconduct-Policy-Procedure
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/Plagiarism-Academic-Misconduct-Policy-Procedure
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/Plagiarism-Academic-Misconduct-Policy-Procedure
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/Plagiarism-Academic-Misconduct-Policy-Procedure
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/Plagiarism-Academic-Misconduct-Policy-Procedure
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/Plagiarism-Academic-Misconduct-Policy-Procedure
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/Plagiarism-Academic-Misconduct-Policy-Procedure
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/Plagiarism-Academic-Misconduct-Policy-Procedure
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/Plagiarism-Academic-Misconduct-Policy-Procedure
http:
www.mit.edu.au/about-mit/institute-publications/policies-procedures-and-guidelines/Plagiarism-Academic-Misconduct-Policy-Procedure
© MIT/SITE | ME606 Digital Signal Processing Assignment 2 Page 2 of 9
ME606 Assessment 2
Introduction
The objective of this assessment is for each student to demonstrate understanding of the
contents of lecture materials in the unit by applying the principles and concepts in lecture
notes. Concepts covered by this assignment include z-transforms, and FIR filter design.
Section 1. FIR filter design
In general, we have 3 commonly used FIR filter design techniques
(1) Windowed Fourier series approach
(2) Frequency sampling approach
(3) Computer-based optimization methods
In this assignment we practice the first and the second methods in designing FIR filters
1-1 Designing a low pass FIR filter using Windowed Fourier Series approach
The amplitude frequency response of an ideal low pass filter is shown in Figure. 1. Its
impulse response can be found from its inverse Fourier transform as:
h = (
ω?
π
) ∗ sinc (
nω?
π
) , n =. . , −2, −1,0,1,2, … , 0 < ω?<π (1)
Figure 1. Ideal low pass filter amplitude frequency response (left) and impulse response (right)
Using the equation (1) we can find all the impulse response samples. The filter is IIR but by
truncating the impulse response to a limited number of samples we can make it an FIR filter.
To do so we usually select M samples (M is usually odd number) around n=0 as shown in
Figure 2.
© MIT/SITE | ME606 Digital Signal Processing Assignment 2 Page 3 of 9
Shift by M/2
Figure 2. Truncated impulse response
By multiplying the resultant impulse response by a window we can reduce unwanted ripples
in the spectrum.
The following Matlab code designs a FIR filter with Windowed Fourier Series approach.
wp=pi/8; % lowpass filter bandwidth
M=121;
n=-(M-1)/2:(M-1)/2; % selection time window
h0=(wp/pi)*sinc((wp/pi)*n); % truncated impulse response
h=h0.*rectwin(M)'; % windowing
% h=h0.*hamming(M)';% windowing
% h=h0.*hanning(M)';% windowing
% h=h0.*bartlett(M)';% windowing
% h=h0.*blackman(M)';% windowing
figure;plot(h)
ylabel('Impulse response')
xlabel('Samples')
% spectrum
FFTsize=512;
pxx=20*log10(abs(fft(h,FFTsize)));
fxx=(0:(FFTsize/2)-1)*(pi/(FFTsize/2));
figure;plot(fxx,pxx(1:FFTsize/2));
ylabel('Amplitude[dB]');
xlabel('frequency [Radian]');grid on
Do the following tasks and plot all the graphs in your report:
1) Run the above program and plot the impulse response and the amplitude spectrum
of the filter.
2) Measure the filter frequency response at p=pi/8. Is it close to the expected value of
-6dB? How much is the maximum ripple in the pass band.
3) This filtering technique does not define any cutoff. If we assume the stopband starts
at -20dB, measure the ratio of the transient band to the pass band.
4) Increase the filter impulse response length to M=255 and run the program.
a) If we assume the stopband starts at -20dB, measure the ratio of the transient
and to the passband.
) Measure the ripple in the passbad.
© MIT/SITE | ME606 Digital Signal Processing Assignment 2 Page 4 of 9
c) Discuss the effect of the filter length on the ripples and stopband attenuation.
5) Use Hamming and Hanning window with the filter impulse response length, M=121,
and discuss the effect of the window on the ripples and stopband attenuation.
6) Change p=pi/4 and repeat 1) and discuss the effect.
1-2 Designing a bandpass FIR filter using Windowed Fourier Series approach
A FIR lowpass filter can be converted to a bandpass filter by multiplying its impulse response
y a complex sinusoidal with the frequency of the center frequency of the desired bandpass
filter. In fact, the whole filter band shifts by this frequency. The following MATLAB code
designs such a bandpass filter:
wp=pi/16; % lowpass filter bandwidth
M=121;
n=-(M-1)/2:(M-1)/2; % selection time window
h0=(wp/pi)*sinc((wp/pi)*n); % truncated impulse response
h1=h0.*rectwin(M)'; % windowing
w0=pi/4; % BPF center frequency
h=h1.*exp(j*w0*n); % Lowpass to bandpass conversion
figure;
subplot(211);plot(real(h));ylabel('Real part of impulse response')
xlabel('samples')
subplot(212);plot(imag(h));ylabel('imag part of impulse response')
xlabel('samples')
% spectrum
FFTsize=512;
pxx=20*log10(abs(fft(h,FFTsize)));
fxx=(0:(FFTsize/2)-1)*(pi/(FFTsize/2));
figure;plot(fxx,pxx(1:FFTsize/2));ylabel('Amplitude
[dB]');xlabel('frequency [Radian]');grid on
Do the following tasks and plot all the graphs in your report:
7) Run the above program and plot the impulse response and the amplitude spectrum
of the filter.
8) What are the passband edges p1 p2. Measure the attenuation in frequency
esponse at these frequencies and compare them with the expected value of -6dB.
9) Measure the maximum ripple in the passband.
10) Increase p to pi/4 and discuss the result
1-3 Designing a band-stop FIR filter using Frequency sampling approach
In this section, you must write your own code to design a band stop filter using the
knowledge you gained from the sections 1-1 and 1-2
© MIT/SITE | ME606 Digital Signal Processing Assignment 2 Page 5 of 9
Write a code to design a band-stop filter. Design a band-stop filter by having the
following block diagram in your mind
The spectrum mask is as the following:
11) Report your MATLAB code. Select the filter impulse response length M=121;
12) Plot the frequency response, |H(ej)|, of your filter on the top of the spectrum mask in a
single plot.
13) Plot 20*log10(|H(ej)|) of your filter on the top of the spectrum mask in dB in a single
plot.
14) Measure the amplitude at =[/4, 3/4, /2] on your second plot.
15) Find the deepest point in your frequency response in dB. How you can increase the
depth of the stopband?
1-4 Designing a low pass FIR filter using Frequency sampling approach
In the frequency sampling approach, we design an amplitude response in the frequency
domain and find the impulse response by applying IFFT on that frequency response.
The following MATLAB code designs a low pass FIR filter using Frequency sampling
approach. It initially designs the amplitude spectrum and the apply IFFT. Using some shifts it
finds the truncated impulse response.
wp=pi/8;
M=121;
FFTsize=512;
% passband frequency samples
Np=fix((wp/(2*pi))*FFTsize); % number of pass band samples
Ns=FFTsize/2-Np; % number of stop band samples
H1=[ones(1,Np) zeros(1,Ns+1)];
H=[H1 H1(end:-1:2)]; % sampled frequency spectrum;
fxx=(0:(FFTsize/2)-1)*(pi/(FFTsize/2));
figure;plot(fxx,H(1:FFTsize/2));
ylabel('Amplitude');
xlabel('frequency [Radian]');grid on
BPF
+
Band-stop
filter X[n]
y[n] -
+
0
1
|H(ej)|
© MIT/SITE | ME606 Digital Signal Processing Assignment 2 Page 6 of 9
% finding impulse response by truncating
h1=real(ifft(H));
h0=[ h1(end-(M-1)/2+1:end) h1(1:1+(M-1)/2)];
figure;plot(h0)
ylabel('Impulse response')
xlabel('Samples')
% spectrum
pxx=20*log10(abs(fft(h0,FFTsize)));
fh=figure;plot(fxx,pxx(1:FFTsize/2));hold on;
% effect of windowing
h=h0.*hanning(M)';% windowing
% spectrum
pxx=20*log10(abs(fft(h,FFTsize)));
figure(fh);plot(fxx,pxx(1:FFTsize/2));grid on;
legend('rectwin','hanning')
Do the following tasks and plot all the graphs in your report:
16) Run the above program and plot the impulse response and the amplitude spectrum
of the filter. Try to understand what the program does.
17) Use the above program as your base, design a band pass filter that passes the
frequencies between pi/8
est of the program.
Section 2. Analyzing a system in Z and time domain
A digital system is given by the