x = @(t) piecewise(t<-2, 0, -2<=t<1, 2*(t+2)^2, 1<=t<3, 18, 3<=t<5, -9*(t-5), t>5, 0);
h = @(t) piecewise(t<0, 0, 0<=t<2, 3*(t+2), 2<=t<4, -6*(t-3), t>4, 0);
tx=-2:0.01:5;
th=0:0.01:4;
xVec = double(subs(x, tx));
hVec = double(subs(h, th));
c = conv(xVec, hVec);
tc = (tx(1)+th(1)):0.01:(tx(end)+th(end));
figure(1)
subplot(3,1,1); plot(tx,xVec);
subplot(3,1,2); plot(th,hVec);
subplot(3,1,3); plot(tc,c);
0 Comments
Sign in to comment.