1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Convolution in MATLAB

  1. Sep 28, 2015 #1
    1. The problem statement, all variables and given/known data
    Use MATLAB to find the convolution between
    a) ##f(t) = u(t) -u(t -3)## and ##g(t) = u(t) -u(t -1)##

    2. Relevant equations

    3. The attempt at a solution
    t = -10: 0.1: 10;
    f = heavisde(t) -heaviside(t -3);
    g = heaviside(t) -heaviside(t -1);
    t = -20: 0.1: 20;
    c = conv(f, g);
    plot(t, c)

    The graph of the convolution has values from 0 to 10. I don't get how the convolution can get to 10 if the functions being convolved only have maximum values of 1. I changed the line to
    c = 0.1*conv(f, g);
    and this produced the right output. Why do I need to multiply by the step size?
  2. jcsd
  3. Sep 28, 2015 #2


    User Avatar
    Homework Helper

    Convolution is a sum over element-wise products. To turn this into the equivalent approximation for the integral, you have to multiply by the step size. Think about the rectangular area. Matlab applies the linear algebra definition of convolution.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted