Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Just the program code please, thank you Question: How to compute the convolution

ID: 1300267 • Letter: J

Question

Just the program code please, thank you

Question: How to compute the convolution of these two signals in MatLa.. (1 bookmark) How to compute the convolution of these two signals in MatLab, without using the conv function/command System response: y(t)= 2tu(t)-3(t-1)u(t-1)-(t2)u(t-2) should be this one according to the book's solutions. Suppose that the system of Figure P3.2(a) has the input x(t) given, in Figure P3.2(b). The impulse response is the unit step fund ion h(t)u(t). Find and sketch the system output y(t). h(0) x(t) 2 Figure P3.2

Explanation / Answer

x = input('Enter x: ');
h = input('Enter h: ') ;
Ni = length(x);
Nh = length(h);
y = zeros(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

stem(y);