Starting from:
$30

$24

Lab Work 6 Solution

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 design a practical IIR filter, test its frequency response, and perform some filtering operations. The IIR filter that you will design will be in the form of a difference equation; therefore, the “design” means to determine the coefficients of the difference equation.

Before you start, read the third and fourth least significant digits of your student number. If these two numbers are the same, read the third and fifth least significant digits; and continue with third and sixth, third and seventh, etc., until the two numbers are not the same. Call these two distinct number as N1 and N2, respectively. Find M1 = (N1 + 2), and M2 = (N2 + 2). Write your N1, N2, M1, and M2.

The filter specifications are as follows:

* Stable (Naturally, this is needed for all practical filters.)

* Bandpass

* Real valued h[n].

* Order of the filter is 3 + N1.

* Cutoff frequencies are min{
π
,
π
} and max{
π
,
π
}

M1

M2

M1

M2


* A stopband and a passband, which are as flat as possible, are desirable.

* Causal; h[n].

Clearly write the analytical details of your design procedure. Avoid computer aided design as much as possible.



Your typical design procedure could be: i) Determine the number of poles from your filter order, ii) If you wish add some zeros iii) Noting the restrictions on the locations of poles and zeros, as a consequence of your specifications, place the poles and zeros on the z-plane iv) Write H(z) = B(z)/A(z), where B(z) and A(z) are obtained from your poles and zeros, first in product from of first order factors, and then as a polynomial of z, then convert them to polynomials of z−1. v) Write your H(z), and the corresponding difference equation using your polynomial coefficients.

1-    Print h[n] as an array, and plot h[n], for a reasonable length. Make a pole-zero plot of H(z). Also plot, H(ejω) , for some discrete values of ω in the range [−π, π), using MATLAB.

2-    As you did in the previous lab work, generate the two discrete chirp signals, x1[n] and x2[n], by sampling
the analog signal xa(t) as xi[n] = xa(nTi); xa(t) = cos(αt2); for x[n1







,

] the sampling rate is T1
=



π

























α512


π








choose













and for x2[n] the sampling rate is T2 =   α8192 ; note that these discrete signals are periodic;√

[n],
range n

[0, 1023] and n

[0, 8191], for x

[n] and x


a finite segment of those signals in the √








1





1



respectively.

3-    Pass your two test signals through your IIR filter, by writing a recursion to implement your difference equation, using MATLAB. Store your output arrays, y1[n] and y2[n] for a suitable duration. Discuss what the output represents. Discuss whether this procedure (passing a chirp through an LTI system) can be used to test/understand the frequency response of the system. Make sure to comment on the limitations, and precautions to relieve those limitations.

4-    As you did in your previous lab work, write a separate MATLAB program to forward the signal x2[n], at a rate of one sample per Ts (Ts is as in (2)), via the system D/A converter as an analog waveform to the system loudspeaker, starting from n = 0, and then continuing indefinitely until the program is stopped manually. (Hint: A natural way to do this is to compute the elements of x2[n] in real time, and to pass the computed elements, one by one as they are computed, at instants separated by precise Ts seconds apart, to the loudspeaker. If this is difficult to achieve in your programming environment, an alternative is (note that x2[n] is periodic) to compute and store one period of the signal to a file (first find the period), off line, and then to retrieve this array from the file many (indefinite) times, one after another, and to forward these arrays seamlessly to the laudspeaker, by instructing the system about the sampling rate.) Thus, you are listening to xr(t); Is it equal to xa(t) in (3)? (Beware: xa(t) is not periodic; try to imagine the sound represented by xa(t).)


5-    Using the same MATLAB program above, listen to yr(t), which is the analog version of y2[n] (i.e., yr(t) is the interpolated version of y2[n] by the system D/A converter using the same sampling rate as in (2) during the D/A conversion; both y2[n] and yr(t) are finite length signals). Comment on what you hear.

6-    Write the cut-off frequencies of the equivalent analog system whose input is xa(t) and the output is yr(t). Plot |Heq(jω)| using MATLAB.

7-    Find out some music stored digitally; find out the sampling rate used during recording. Store a finite portion of the music as an array, and then, pass it through your filter; store the output, as well. Listen

to the input, and then the output, at the same rate. Comment on the results, and discuss. (Hint: Your MATLAB may open and store an array from a music file, if the file is one of the standard audio files.)

8-    Repeat (6) by digitizing your voice as you speak, using a microphone and the system A/D converter. (Hint: First store your digitized voice for a few seconds, as a standard audio file; then your MATLAB may be able to open this file and generate an array from it.)



























(⃝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.)

More products