The purpose of this problem is to use MATLAB to perform discrete-time convolutio
ID: 2294173 • Letter: T
Question
The purpose of this problem is to use MATLAB to perform discrete-time convolution and to solve a linear difference equation. Consider an LTI system described by the difference equation y[n] 0.8y[n-1]-2x[n] under the assumption of initial rest. We want to use MATLAB to compute the output y[n] for the following three inputs x[n]: (i) u[n] - u[n-2], (ii) u[n] 2u[u-2]+ un-6], and (ii) (0.7)*n ufn]. This should be done for each input using the three methods given below. For each method, turn in a listing of the code used to compute y[n], along with plots of x[n] and y[n] on the same axes (using an appropriate range 5. 5 of n to adequately illustrate the solution). a) (10 pts) Design a program to implement this equation directly in MATLAB. That is, your program should perform the recursion similar to that in Example 2.15. b) (10 pts) Design a program to implement the convolution sum directly. This should be written for arbitrary x[n] and h[n]. Note that to do this, you will have to determine the impulse response h[n] of this system, either analytically or using the results of part a) c) (5 pts) Use the convO function to compute the convolution. The convO function is a built-in function of MATLAB. Compare the results that you obtain to those in parts a) and b).Explanation / Answer
a)
function [t,index]=recursion
b)
x = input('Enter x: ');
h = input('Enter h: ') ;
Ni = length(x);
Nh = length(h);
y = 2 x(n)0.8y(n-1)(1,Ni+Nh);
t = zeros(1,Nh);
for i = 1:Ni+Nh-1
if i<=Ni
t(1)= x(i);
for j = 1:Nh
y(i) = y(i) + h(j)*t(j);
end
for k = Nh:-1:2
t(k) = t(k-1);
end
else
t(1)= 0;
for j = 1:Nh
y(i) = y(i) + (h(j)*t(j));
end
for k = Nh:-1:2
t(k) = t(k-1);
end
end
end
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.