$24
Work on these questions as a homework first: answer the analytical parts of the questions and write the answers on a paper, write a MATLAB program (or many such programs) to perform the tasks that need computation, print your MATLAB code(s), print your computer outputs (numerical and graphic) whenever needed; the collection of all those will be your lab report. Bring your code (in a computer readable form) to the lab; transfer your code to one of the lab computers; run and show your TA the results. Answer all the questions your TAs may ask. Modify your lab report, including any modifications needed in your MATLAB codes, during the lab hours in the lab. Finally, hand your TAs the lab report prepared as described above. Your report will get a grade based on your preparedness when you come to the lab, performance of your codes in the lab (any modifications needed and conducted during the lab hours included), your answers to the oral questions during your demo(s) in the lab, and the entire content of the submitted report at the end of the lab.
******************************
In this work, you will investigate some FIR filters.
1- An FIR filter is specified as:
y[n] = 211 ∑10 x[n − k]
k=−10
a) Plot h[n]. Analytically find and plot (by hand) the magnitude and the phase of the frequency respose of this filter. Then, use MATLAB to plot the same magnitude and the phase response. By the way, since the frequency response of a discrete filter is periodic with a period of 2π, it is sufficient
to plot only these graphs in the range [−π, π). Indeed, since the frequency response is a conjugate symmetric function for real valued impulse responses, it is sufficient to plot these functions only for [0, π]; the rest is known, anyway, due to above symmetry and periodicity conditions.
(Note: a complex valued function f (x) is conjugate symmetric iff f (x) = f ∗(−x) The definition is the same for continuous and discrete functions.)
b) Let,
x1[n] = 1
2π π
x2[n] = cos( 28 n + 4 )
2π
x3[n] = 3 cos( n)
11
x[n] = x1[n] + x2[n] + x3[n] + x4[n] .
Analytically pass each xi[n] separately through the above filter, and find the corresponding outputs yi[n]’s; and then pass x[n] through the same filter and find the corresponding output y[n].
c) Using MATLAB, pass each xi[n] separately through the filter, to get yi[n] = T {xi[n]}, i = 1, 2, 3, 4. Plot each xi[n] and yi[n] pair, for n ∈ [0, 255], on the same graph, using the same scale. (Plot x1[n], y1[n] on a graph, x2[n], y2[n] on another graph...; four such graphs.)
Compare and discuss the effect of the filter on the amplitude and the phase of each xi Also compare and discuss the analytical and experimental results.
d) Using MATLAB, pass x[n] through the filter to get y[n]. Plot x[n] and y[n] on the same graph using the same scale for both. Discuss the effect of the filter on this input. Compare the analytical and the experimental results.
2- Replace the FIR filter of (1) above by,
y[n] = 2x[n] − 2x[n − 1]
Repeat (1).
3- Replace the FIR filter of (1) above by,
y[n] = 0.5x[n + 1] + 1.5x[n] + 0.5x[n − 1]
Repeat (1).
4- Replace the FIR filter of (1) above by,
y[n] = −0.5x[n + 1] + 1.5x[n] − 0.5x[n − 1]
Repeat (1).
5- Comment on the results: try to discuss the frequency selectivity and the practical use of the filters given above.
(⃝cLevent Onural, 2018. Prepared only for the students registered to EEE321 course at Bilkent University in 2018-2019
fall semester. Not to be distributed to others by any means.)