Unfortunately indexing the output of convolution product confuses me. Suppose $x[n]$ is of length $15$ (i.e. $0 <= n <= 14$) and $y[n]$ has the length of $9$ ($0 <= n <= 8$). if $z[n]$ be the output of convolution product of $x[n]$ and $y[n]$, that is $$z[n] = (x * y)[n] = \sum_{k=-\infty}^{+\infty} x[k]y[n-k]$$ As a result, $z[n]$ would has the length of $23$, right? Now the question is what is the range of $n$ for $z[n]$? Is it $0 <= n <= 22$ or $-4 <= n <= 18$?
From formula for convolution I think the latter is true. But the problem arises when I work with seismic signals.
Suppose $acc[t_i]$ is seismic signal of Kobe earthquake where $0 <= t_i <= 41.99 sec$ with sampling period of $T_s = 0.01 sec$ (length of signal $4200$) as depicted below:

Seismic signal, Kobe Japan, 1/16/1995 Now it is desired to denoise $acc[t_i]$ using moving average filter with impulse response $h[t_i]$:
$$ h[t_i] = \begin{cases} \frac{1}{30}, & \text{if $0 <= t_i <= 0.29$} \\ 0, & \text{if $0.3 <= t_i <= 41.99$} \end{cases}$$ where $T_s = 0.01 sec$. After applying $h[t_i]$ to $acc[t_i]$ by convolution, the output is the sequence $ACC[t_i]$ of length 8399, as shown in following figure.
Denoised seismic signal, Kobe Japan, 1/16/1995 Obviously the results of filtering process is the interval marked by red bullets. However according to convolution formula, I think I should label time axis between approximately $-21sec$ to $63sec$.
Is that right or something is missing?


If $x[n]$ and $y[n]$ are both causal and starting at index $0$, then the result of convolution will also be causal and it will start at index $0$. Just plug in $n=-4$ in the expression for $z[n]$, you will find that it will be $0$. $$z[n] = \sum^{\infty}_{k=-\infty}x[k]y[n-k]$$ First non-zero term in above expression is at $n=0$. Because for $k<0$, $x[k]$ will be $0$, you can re-write the above expression as: $$z[n] = \sum^{\infty}_{k=0}x[k]y[n-k]$$ In the above expression, put $n<0$, you will see that $y[n-k]$ will always be 0.

There will be a transient delay of $N-1$ samples, when you are using Moving-Average FIR Filter of length $N$, not an advance. The delay is due to the fact that you need $N-1$ previous samples of the input before you can produce an average of $N$ samples. You cannot have an output before you feed input to a causal FIR filter. Expecting an output at $-21sec$, is expecting to look into future which is not correct here.

The figures you have posted is showing that you have 8399 samples of output starting at $n=0$. As you can see, approximately at $5sec$, the seismic activity starts, Moving average just smoothens-out the original input signal with a transience of $0.3sec$.

| improve this answer | |
  • $\begingroup$ Would you take a look here: en.wikipedia.org/wiki/Convolution#/media/…. It is an animation which shows the sliding filter along time axis that meet the input signal at t = -0.5 sec. But the indexing of output starts at t = -1.0 sec (the center of filter when it meet the input signal). The same is true in the example that I depicted. Filter meet seismic signal at t = 0 sec when its center is approximately at t = -21 sec. Your answer physically make sense but I cannot inferred it from formula. Finally, what about non-casual filters? $\endgroup$ – Pirooz Jun 23 at 5:04
  • 1
    $\begingroup$ @Pirooz In that wiki example, both signals are starting at $t=-0.5sec$, and that is why when one is time-reversed and being sled along timeline, the overlap begins at $t=-1sec$. Look closely at the red function which is moving on time-axis. The dotted line in its middle is the value of $t$ in convolution integral. Check closely that when the overlap starts, at that moment dotted line is at $t=-1sec$. Whereas in your question both signals start at $n=0$, hence the overlap also cannot start before that. Non-causal Filters can use before-hand stored input samples in advance to produce output. $\endgroup$ – DSP Rookie Jun 23 at 6:48

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.