I've just finished covering convolutions in my signals class, and I've been playing around with the conv function in MATLAB, but there's something I don't quite understand. Say I have two discrete signals, $a$ and $b$ sampled at $dt$. As $dt \rightarrow 0$, the amplitude of the result increases. Since the convolution integral is just $$ y(t)=\int_{-\infty}^\infty f(\tau)h(t-\tau)d\tau, $$

why does the resulting convolution seem to depend on what my value is for $dt$? By decreasing the sampling rate, shouldn't I just have a better approximation?


Very informally, you can think of the integrand as the product of $f(\tau)h(t-\tau)$ and the differential $dt$. In Matlab, you can approximate this by multiplying the discrete convolution by the sampling interval, as in this example:

% sample rate is 0.01 seconds
dt = 0.01;
t = 0:dt:1;
f = exp(-t/2);
h = ones(1,length(t));
c = dt*conv(f,h);
% sample rate is now 0.001 seconds
dt2 = 0.001;
t2 = 0:dt2:1;
f2 = exp(-t2/2);
h2 = ones(1,length(t2));
c2 = dt2*conv(f2,h2);
% confirm that the two convolutions are the same

Note that what you're trying to do is approximate a result from continuous signal processing using discrete signal processing. Usually, and as this example shows, you have to be careful. Similar situations arise when trying to estimate a signal's energy or its Fourier transform.

As a final note, as CMDoolittle mentions, the correct discrete convolution is calculated by conv(f,h), without including dt.

  • $\begingroup$ Thanks for the detailed explanation and example. Another quick question. If I were to have a 'continuous' signal, would dt*conv() be a better solution that just conv()? $\endgroup$ Sep 27 '15 at 1:51
  • $\begingroup$ @user3254763, you can't have a continuous signal in Matlab (unless maybe you use the symbolic toolbox). But you can use Matlab's discrete math to approximate operations on continuous signals. However, discrete computations (conv(g,h)) are not exactly the same as continuous operations ($g(t)\ast h(t)$); you need to make some adjustments to your operations. So, in brief: you should use dt*conv() when using Matlab to approximate an "analog" convolution. $\endgroup$
    – MBaz
    Sep 27 '15 at 16:29

Your computer doesn't compute the continuous integral, it does discrete convolution, which is just a sum of products at each time step. When you increase dt, you get more points in each signal vector, which increases the sum at each time step. You must normalize the result of conv() according to the length of the vectors involved.

  • $\begingroup$ So from MBaz, I see that normalizing it produces the same amplitude regardless of the sampling. I also get why that's the case, but I'm not quite sure why it has to be done. Is it done just to get a more accurate result? $\endgroup$ Sep 27 '15 at 2:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.