Using MATLAB find yt xt ht for each paired xt and ht in Fi
Using MATLAB find y(t) = x(t) ? h(t) for each paired x(t) and h(t) in Figure 2. PLEASE SHOW MATLAB CODE
Problem Statement 2 Using MATLAB find y(t) z (t) h (t) for each paired T (t) and h (t) in Figure 2. z(t) h (t) (a) h(t) z(t) (b) Figure 2: Signal pairsSolution
To Solve it, there are 3 ways using matlab. first you can directly use conv function, other is you can use laplace tranformation unction and laplace these functions directly and then product them. Third is you can find convolution of both the parts by using this coding.
(b) Here question wants to do the convolution of signal in terms of MATLAB x(t) which is =(heaviside(x-2), [-5, 5])
and signal h(t) which is = (ramp = t.*unitstep), and then use t for h(t)
now use coding:
clear all
close all
x=input(\'Enter the first sequence: \');
l1=input(\'Enter the lower limit: \');
u1=input(\'Enter the upper limit: \');
x1=l1:1:u1;
h=input(\'Enter the second sequence: \');
l2=input(\'Enter the lower limit: \');
u2=input(\'Enter the upper limit: \');
h1=l2:1:u2;
l=l1+l2;
u=u1+u2;
n=l:1:u;
s=numel(n);
i=1;
for i=1:s
y(i)=0;
for k=1:numel(x)
if (i+1-k)<=0
y(i)=y(i)+(x(k)*0);
else if (i+1-k)>numel(h)
y(i)=y(i)+(x(k)*0);
else
y(i)=y(i)+(x(k)*h(i+1-k));
k=k+1;
end
end
end
i=i+1;
end
disp(y);
subplot(2,2,1);stem(x1,x);
title(\'First sequence\');xlabel(\'n\');ylabel(\'x(n)\');
subplot(2,2,2);stem(h1,h);
title(\'Second Sequence\');xlabel(\'n\');ylabel(\'h(n)\');
subplot(2,2,[3 4]);stem(n,y);
title(\'Convoluted sequence\');xlabel(\'n\');ylabel(\'y(n)\');
