Attachment 1

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

EE 3032: Signals and Systems | Imas, Olga

Take-Home Assignment 2 (100 pts)

Instructions
• You are permitted to use any available resources to complete this assignment.

• You are to work on this assignment with one partner of your choice, or independently.

• The assignment is due on Friday of Week 9 by 11:59 pm in Canvas in pdf format. One person per group should upload
the assignment, but both names must be included in the submitted document.

• Late assignments will be penalized per course policy (see the syllabus for details).

• Complete this assignment in MATLAB Live Script. Be sure to document your code appropriately to explain your logic
and highlight the methods you used. Be sure to use the formatted text options and equation editor of the MATLAB
Live Script for your code documentation. Use the class MATLAB examples as your guide to code documentation. Once
executed, save the Live Script in the pdf format with the code, documentation, and results displayed in the same
document.

MATLAB Assignment
Problem Description and Requirements

Numerical convolution in time domain is one way of implementing digital filtering. In the following convolution equation,
𝑥𝑥(𝑡𝑡) is the input signal, ℎ(𝑡𝑡) is the impulse response of the filter, and 𝑦𝑦(𝑡𝑡) is the filtered signal output.

𝑦𝑦(𝑡𝑡) = 𝑥𝑥(𝑡𝑡) ∗ ℎ(𝑡𝑡)

Generate the following causal input signal 𝑥𝑥(𝑡𝑡) containing three sinusoidal components with frequencies f1 = 2 Hz, f2 = 10
Hz, and f3 = 90 Hz, and amplitudes 2, 3, and 0.7, respectively. The duration of the signal is 2 seconds, and the sampling
interval is 1/200 sec. The frequency component f3 = 90 Hz represents the interference or noise frequency in the signal 𝑥𝑥(𝑡𝑡).
Plot the signal 𝑥𝑥(𝑡𝑡) as a function of time. Assume the units of the signal are Volts.

𝑥𝑥(𝑡𝑡) = 𝐴𝐴1 sin(2𝜋𝜋𝑓𝑓1 𝑡𝑡) + 𝐴𝐴2 sin(2𝜋𝜋𝑓𝑓2 𝑡𝑡) + 𝐴𝐴3 sin(2𝜋𝜋𝑓𝑓3 𝑡𝑡)

A typical linear digital filter is a mathematical equation with an output that represents a linear combination of amplitude-
scaled and time-shifted elements of the input. The following equation represents a low-pass (smoothing) filtering
operation where 𝑥𝑥(𝑛𝑛) is the input signal and 𝑦𝑦(𝑛𝑛) is the filtered output signal. This equation is a discrete representation
of linear differential equation representing a smoothing (lowpass) filter. Note that the equation is expressed as a function
of 𝑛𝑛 which is the sample number of the causal signal 𝑥𝑥(𝑛𝑛). Once the output signal 𝑦𝑦(𝑛𝑛) is computed, it can be easily
plotted as a function of time 𝑡𝑡 which the sample numbers 𝑛𝑛 refer to.
EE 3032: Signals and Systems | Imas, Olga

1
𝑦𝑦(𝑛𝑛) = {−21𝑥𝑥(𝑛𝑛) + 14𝑥𝑥(𝑛𝑛 − 1) + 39𝑥𝑥(𝑛𝑛 − 2) + 54𝑥𝑥(𝑛𝑛 − 3) + 59𝑥𝑥(𝑛𝑛 − 4) + 54𝑥𝑥(𝑛𝑛 − 5) + 39𝑥𝑥(𝑛𝑛 − 6)
231
+ 14𝑥𝑥(𝑛𝑛 − 7) − 21𝑥𝑥(𝑛𝑛 − 8)}

It can be shown that the impulse response function ℎ(𝑡𝑡) of the filter given above is the set of coefficients of this equation
associated with each 𝑥𝑥(𝑛𝑛 − 𝑎𝑎) term and arranged as a row vector of the size 1 x 9.

1. Hence to perform the filtering operation, create the impulse response function ℎ(𝑡𝑡) of the given filter by
extracting the filter equation coefficients and arranging the coefficients in the row vector.
2. Filter the signal 𝑥𝑥(𝑡𝑡) by performing the convolution of 𝑥𝑥(𝑡𝑡) with ℎ(𝑡𝑡). Refer to the class video on the use of
appropriate function for numerical convolution. The duration of the output signal must match the duration of the
input signal when completed, so be sure to investigate additional input arguments of the convolution function,
which would allow you to do that easily.
3. Plot the output signal 𝑦𝑦(𝑡𝑡) as a function of time 𝑡𝑡 and compare it to the original signal 𝑥𝑥(𝑡𝑡). Be sure to provide a
figure containing both signals for comparison. What changed?

You might also like