Ecet345- write a matlab program that convolves the 10 hz


Assignment: Signals and Systems

Class Room Activity: Convolution of signals

Objective of the lab experiment:

The objective of this experiment is todemonstrate how the convolution is used to process signals entering a system.

Equipment list:

Experimentally measured characteristics plus input and output of a filter (available in Doc Sharing as listed below)

MATLAB

Software and/or other files needed:

Filter_IO_and_impulse_response.mat:It contains data you will need to complete this lab. It is available in Doc Sharing. If not, it is also available fromProfessor Ajeet Singh of DeVry University, Fremont, CA ([email protected]).

Example_of_Convolution_of_discrete_sequences.docx: Thisis a graphical demo of how convolution of two discrete time sequences is carried out. This file is located in Doc Sharing.

Example_of_convolution.m: This file is located in Doc Sharing. It is a MATLABm file that demonstrates how sequences are convolved in MATLAB.

Theory

We learned earlier in the lecture that the output of a linear time invariant (LTI) system, in time domain, is simply the input to the system convolved with its impulse response. We also learned that impulse response is the transfer function of the system inverted back into time domain, thus establishing the equivalence of the two pieces of knowledge. Recall also that convolution of two continuous functions of time f(t) and g(t) is defined as

y(t)= ∫_0^t f(τ)g(t-τ)dτ where g(t-τ) is simply one of the signals reflected (g(τ)replaced by g(-τ)) and delayed in time by t seconds. Thus, if f(t) is the impulse response of the system, its output for any signal input g(t)can be obtained by evaluating this integral. The equivalent sum in discrete or sampled systems is given by

y[n]=x[n]?h[n]=∑_(i=-∞)^∞ x[i]h[n-i] =∑_(i=-∞)^∞ x[n-i]h[i] ,

wherey[n] is the discrete sequence coming out of the system,x[n] is the input sequence entering the system,h[n] is the discrete time impulse response of the system, and the symbol? is used to denote the convolution. When input sequences and impulse response are causal and of finite length, as is the case in practice for many systems, the limits of summation are changed from zero to a finite upper number, instead of minus to plus infinity.In other words, the convolution for finite length sequences and impulse response becomes

y[n]=x[n]?h[n]=∑_(i=0)^N x[i]h[n-i] =∑_(i=0)^N x[n-i]h[i] ,

where N is a finite number.Because in the modern world we store the signals after sampling, we shall use the discrete time definition of convolution. This makes it possible to compute the convolution sum, y[n], using a computer, which is what we shall do in this lab. For short enough signals and impulse responses, the sum can be computed manually as shown in the demo example stored in Doc Sharing under the headingExample_of_Convolution_of_discrete_sequences.docx.

For the purpose of this lab, we have measured and stored the impulse responseas well as the input to and output froma 50 Hz low-pass filter for a variety of signals. These data are stored in in the MATLAB data fileFilter_IO_and_impulse_response.mat,whichcan be downloaded from Doc Sharing.

Completing the Lab

Step 1

Download the file Filter_IO_and_impulse_response.matfromDoc Sharing onto your desktop. If it is in a compressed (.zip) form, decompress it on the desktop of the computer you are using.

Open MATLAB version 7 (or higher) and change the directory to your desktop. See the tutorial at the end of the lab on how tochange the directory when using a Citrix server and load the fileFilter_IO_and_impulse_response.matinto MATLAB.

To load the data file, go to the command window of MATLAB and give the command loadFilter_IO_and_impulse_response.matas shown below.

>> load Filter_IO_and_impulse_response.mat

This will cause the data to be loaded into MATLAB memory. Then give the command whos as shown below.

Your workspace should show an output as shown below. From this information, one can deduce which signals are present in the MATLAB memory,how many data points are there in each signal, and the total amount of memory that the data are using up.

>> whos

NameSizeBytesClass

IR6694x153552double array
sixty_sine_input32768x1262144double array
sixty_sine_out32768x1262144double array
ten_sine_input32768x1262144double array
ten_sine_output32768x1262144double array
time32768x1262144double array
tri_input32768x1262144double array
tri_output32768x1262144double array

Grand total is 236070 elements using 1888560 bytes

Here is an explanation of signals that are now loaded in the MATLAB memory.

IR Experimentally recorded impulse response of the 50 Hz low-pass filter
Sixty_sine_input Vector of experimentally recorded 60 Hz sine wave input to the filter
Sixty_sine_outVector of experimentally recorded 60 Hz sine wave output from the filter
ten_sine_input Vector of experimentally recorded 10 Hz sine wave input to the filter
ten_sine_output Vector of experimentally recorded 10 Hz sine wave output from the filter
tri_input Vector of experimentally recorded 10 Hz triangular wave input to the filter
tri _output Vector of experimentally recorded 10 Hz triangular wave output from the filter
time Vector of time showing time points at which experimental data were recorded.

At this point, the data are loaded in MATLAB memory and we are ready to perform convolution of different signals.One of the signals that is loaded into memory is the impulse response of a 50 Hz cutoff low-pass filter whose Bode plot is shown below.

Figure 1. Experimentally measured frequency response (Bode plot) of a 50 Hz low-pass filter

The impulse response of the filter was recorded experimentally by applying an approximation of the impulse to the filter using the Tower board and storing the output using data acquisition equipment. We shall convolve this impulse response with the various inputs we apply to this filter to check whether we get an output that agrees with the output that was measured experimentally. In this effort, you can use, as your template, the MATLAB file Example_of_convolution.m.

As a first step, using the plotcommand of MATLAB,plot the impulse response (MATLAB memory variable IR)as a function of time. If you are not familiar with the plotcommand, run the MATLAB file Example_of_convolution.m located in Doc Sharing. You may also look up help for this command in the MATLAB help menu, where clear examples of how to use this command are given, and also read the MATLAB tutorial MATLAB_intro located in Doc Sharing.

One of the difficulties that you will encounter as you do so is that MATLAB may give you an error saying that "vectors must be of same length." In order to overcome this difficulty, use the length command of MATLAB to force the two vectors to be of same length, as shown in the MATLAB file Example_of_convolution.m.Study this file, run it in MATLAB, and follow it as a template in your own attempts of convolving signals.

Paste the plot of IR as a function of time here. Be sure to label the axes and give a suitable title to the plot or you will suffer a penalty.

Step 2

Write a MATLAB program that convolves the 10 Hz triangular input with the impulse response of the filter, and plot the following variables as a function of time on a single graph. To see how it is done, run the MATLAB file Example_of_convolution.m located in Doc Sharing.For the purpose of plotting use a proper scaling_factorfor convolved output before you plot it. This will allow us to see the shapes of all variables properly in a single plot(see the file Example_of_convolution.m for an example of how scaling factor is used). If you do not scale the variable with the largest amplitude, then you will not be able to see the shape of signals whose amplitude is significantly smaller. Choose an appropriate number of points so that output from 0-0.5 seconds is displayed and use a line width of 2, as is done in the sample program.

Obtain 10 Hz triangular input in blue

Output obtained by convolving the 10 Hz triangular input with the impulse response in red

Be sure to label the axes and give a title to the plot or you will suffer a penalty.

Paste the plot as asked for in step 2 here. Be sure to label the axes and give a suitable title to the plot or you will suffer a penalty.

Step 3

Modify yourMATLAB program such that it convolves the 10 Hz sine wave input with the impulse response of the filter, and plot the following variables as function of time on a single graph. For the purpose of plotting, use a proper scaling_factor for convolved output before you plot it. This will allow us to see the shapes of all variables properly in a single plot(see the file Example_of_convolution.m for an example of how scaling factor is used). If you do not scale the variable with the largest amplitude, then you will not be able to see the shape of signals whose amplitude is significantly smaller. Choose an appropriate number of points so that output from 0-0.5 seconds is displayed and use a line width of 2, as is done in the sample program.

Obtain 10 Hz sine wave input in blue

Output obtained by convolving the 10 Hz sine wave input with the impulse response in red

Be sure to label the axes and give a title to the plot or you will suffer a penalty.

Paste the plot as asked for in step 3 here. Be sure to label the axes and give a suitable title to the plot or you will suffer a penalty.

Step 4

Modify your MATLAB program such that it convolves the 60 Hz sine wave input with the impulse response of the filter, and plot the following variables as function of time on a single graph. For the purpose of plotting, use a proper scaling_factor for convolved output before you plot it. This will allow us to see the shapes of all variables properly in a single plot (see the file Example_of_convolution.m for an example of how scaling factor is used). If you do not scale the variable with the largest amplitude, then you will not be able to see the shape of signals whose amplitude is significantly smaller. Choose an appropriate number of points so that output from 0-0.5 seconds is displayed and use a line width of 2, as is done in the sample program.

Obtain 60 Hz sine wave input in blue

Output obtained by convolving the 60 Hz sine wave input with the impulse response in red

Impulse response of the filter in green

Be sure to label the axes and give a title to the plot or you will suffer a penalty.

Paste the plot as asked for in step 4 here. Be sure to label the axes and give a suitable title to the plot or you will suffer a penalty.

Now answer the questions below.

Convolution in the time domain is equivalent to what mathematical operation in the frequency domain?

Multiplication

When we convolve the triangular 10 Hz input with the impulse response of the 50 Hz low-pass filter, why is it that the peaks of output become rounded and not a sharp point as in the input triangular function?

This is because a 10 Hz triangular wave consists of many harmonics at multiples of 10 Hz, eg. 60 hz, 70 Hz etc.

The filter cuts out these harmonics which round the peak.

Why is it that we get no (or very little) output when we convolve the 60 Hz sinusoid with the impulse response of the filter?

60Hz is 10Hz higher than the highest frequency that the filter was designed to pass, 50Hz.

When we apply the 10 Hz output, which is within the pass band of the filter, we see that we get nearly the same sinusoid in the output except for a time delay. How is the time delay a signal experiences as it passes through a system related to the phase characteristic of the system response?

Time delay = (phase lag in degrees/360)*period of th

Attachment:- Convolution of signals.rar

Solution Preview :

Prepared by a verified Expert
Other Engineering: Ecet345- write a matlab program that convolves the 10 hz
Reference No:- TGS02174665

Now Priced at $40 (50% Discount)

Recommended (93%)

Rated (4.5/5)