Sie sind auf Seite 1von 2

Lab #4 (Convolution in discrete time -1)

In this lab, you will design your own convolution function in discrete time called
MyDTconv. You may choose any way among three different ways explained in class.
Or, you may develop your own way for DT convolution. You need to compare your
results with the results obtained from built-in DT (Discrete Time) convolution, conv.

1. Design your own DT convolution function

In this step, you have to design your own DT convolution function, called MyDTconv.
The function must have two inputs of x and h that are corresponding to an input and the
impulse response of a system respectively. The function has an output, y, that is the
convolution result, i.e., y=x*h. Write MATLAB codes to make your own DT convolution
function. You can choose a way among three different ways explained in class.
However, make sure that you can implement it easily depending on your choice. (Hint:
the array method (method 3) is easier than the table method (method 2) in
writing codes.)

2. Compare your function with the built-in function, conv


We used the conv function in previous lab. The conv function is the DT convolution
function. Check the help file of conv function to refresh how to use it. On a figure,
overlap two results from MyDTconv and conv with different colors. If two results
are same, only one color must be shown on the figure. You must check it again after
exchanging colors to make sure two functions have data.

3. Lab report
For a lab report, incorporate an input and an output of time index into your function in
the Step 1. In other words, your DT convolution function must have two more inputs of
tx and th for time indices of x and h respectively. Furthermore, your function must have
an output of ty for time index of y. Test your function with random numbers. An
example to test your function is as follows:

>> x = randn(1,100); tx=-5:1:length(x)-6;


>> h = randn(1, 35); th=-2:1:length(h)-3;
>> [ty y] = MyDTconv(x,tx,h,th);
Plot your output function y with time index ty. Submit all documents and plots
supporting your design.

Das könnte Ihnen auch gefallen