Asked by Dennis
on 23 Oct 2014

I am given two functions x(t) =5[u(t+1)-u(t-1)] and h(t)=u(t-1)-u(t-7). I am asked to convolve these two signals and plot the result in the range -3 to 10. Here is the code that I wrote:

t=-3:0.1:10; t_c=-3:0.05:10; h_t=heaviside(t-1)-heaviside(t-7); x_t1=5.*(heaviside(t+1)-heaviside(t-1)); c_x_h=conv(x_t1,h_t); figure(1) plot(t_c,c_x_h)

However, since this is a simple convolution I verified it by hand and it does not look like the plot i get in MATLAB. The max value should be 10 but in MATLAB i get 100. Also, the duration of the function should be 8 but i get 4 with MATLAB. Please help.

Answer by Rick Rosson
on 23 Oct 2014

Accepted Answer

Please try:

t_c = -6:0.1:20;

and:

dt = t(2) - t(1); c_x_h = dt*conv(x_t1,h_t);

Baiyu Zhang
on 28 Jun 2018

What is dt = t(2)-t(1)? What does it mean?

Celeste MacNeil
on 14 Oct 2018 at 5:58

What do you mean dt = t(2)-t(1)?

Celeste MacNeil
on 14 Oct 2018 at 6:01

I assume you just mean the step?

Sign in to comment.

Answer by IKRAM jebali
on 31 Mar 2017

Hello! Thank you. I'had the same problem. Me too amnclear as to why the dt is needed though and why t_c needed to be extended to -6 to 20. I use it but i don't know why? There is any answer please. Thank you.

Aswin Farzana Mohamed Ansar
on 20 Oct 2017

Sign in to comment.

Opportunities for recent engineering grads.

Apply Today
## 0 Comments

Sign in to comment.