EEE321 Lab Work 5 Solution

$24.99 $18.99

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…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Categorys:

Description

5/5 – (2 votes)

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 FIR filter, test its frequency response, and perform some filtering operations. Designing a filter means i) to find out and provide an impulse response h[n], ii) provide a digital network whose impulse response is as in (i). We will skip (ii) since the implementation will be via software using MATLAB.

Before you start, read the second and third least significant digits of your student number. If these two numbers are the same, read the second and fourth least significant digits; and continue with second and fifth, second and sixth, 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:

* Bandpass filter

* Real valued h[n].

* Length of the filter is L = 8 + N1.

* Cutoff frequencies are min{

π

,

π

} and max{

π

,

π

}

M1

M2

M1

M2

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

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

1- Print h[n] as an array. Plot h[n]. Plot the zeros of H(z). (Please note that H(z) is the z-transform of

h[n] that is defined as H(z) =

h[n]z−n. For an FIR filter, this is a polynomial of z1; therefore,

n=−∞

zeros of H(z)” are the values of z that make H(z) = 0.) Also plot H(e

) .

2- A way to test the frequency response of a filter is to apply a chirp signal as an input, and observe the corresponding output. Consider the analog signal xa(t) = cos(αt2), t (−∞, ∞). t;is in seconds. This signal is called two-sided chirp signal. Is this signal periodic? Justify your answer, and if periodic, find its period. What is the instantenous frequency of this signal? (Instantenous frequency of a signal cos(ϕ(t)) is a time-varying function defined as ωi(t) = dt(t) ; if this signal is a slowly varying function

of t it may be interpreted as the time-varying frequency of the cosine.) Sample this analog signal with

a sampling period Ts =

π

seconds to get a discrete signal x1[n] = xa(nTs). Is x1[n] periodic?

α512

Justify your answer, and if it is periodic, find its period. Form the finite input sequence xf [n], where xf [n] = x1[n] for n [0, 1023], and xf [n] = 0 for all other n. Store xf [n] in a file. Plot xf [n]. Does xf [n], and therefore , x1[n] looks like xa(t)? (Hint: Try to understand the nature of xa(t).)

3- Let α = 1000 rds2 in (2), the sampling rate to Ts =

π

s. Obtain x2[n] = xa(nTs) with these

α8192

parameters. Form the finite input sequence xg[n], where xg[n] = x2[n] for n [0, 8191], and xg[n] = 0 for all other n. Store xg[n] in a file.

4- Pass xf [n] through your FIR filter. Store the output y1[n], for n [0, 1022 + L]. Plot y1[n]. Identify and show the transient and steady state parts of the output. 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.

Also pass xg[n] through your filter and store the output y2[n] for n [0, 8190 + L].

5- Write a separate MATLAB program to forward the signal x2[n], at a rate of one sample per Ts (Ts is as in (3)), 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).)

6- 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 (3) during the D/A conversion; both y2[n] and yr(t) are finite length signals). Comment on what you hear.

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

8- 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.)

9- 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 2017-2018

spring semester. Not to be distributed to others by any means.)

EEE321 Lab Work 5 Solution
$24.99 $18.99