2
$\begingroup$

Let's say I have a signal like x[k] = [-20 -50 -30 50 30 -60 60 -60 60 10 5 10 5 5], and I want to apply a lowpass and a highpass filter to this signal (separately). For example the impusle response of the filters are as follows:

Lowpass: h[k] = [-1 2 6 2 -1], k = -1,0,...,3

Highpass: g[k] = [-1 2 -1]; k = -1, 0, 1

How can I calculate the first four signal values after applying these filters?

$\endgroup$
3
$\begingroup$

Another way to simply get your result for this kind of a problem (where $h[n]$ is very short) is to use the following method :

Let your output of the discrete convolution sum be $y[n]$ : $$ y[n] = x[n] \star h[n] $$

Then by expanding $h[n]$ into impulses, the convolution will be distributed over addition ( using the highpass filter {-1,2,-1}; k = -1,0,1; to demonstrate ) :

$$ y[n] = x[n] \star \{ -\delta[n+1] + 2 \delta[n] - \delta[n-1] \} $$

$$ y[n] = - x[n+1] + 2 x[n] -x[n-1] $$

By simple argumentation of convolution nonzero ranges, it can be seen that $y[n]$ starts at the index $n=-1$ hence the first sample of the output is:

$$ y[-1] = -x[0] + 2 x[-1] - x[-2] = -x[0] = 20 $$

Note that $x[n]=0$ for $n<0$; The second sample of $y[n]$ will be $y[0]$ which is:

$$ y[0] = -x[1] + 2 x[0] - x[-1] = 50 + -40 = 10 $$

and so on... You can apply the procedure for your other filter and other output samples

| improve this answer | |
$\endgroup$
2
$\begingroup$

The discrete convolution of a signal $x[k]$ with an impulse response $h[k]$, where $k$ is the discrete time index, is computed as

$$y[k] = x[k] \ast h[k] = \sum_{n=-\infty}^{\infty} x[n] \cdot h[k-n].$$

for a given sample index $k_0$, e.g. $k_0 = 0$, you can compute the first sample of your exercise as

$$ y_\text{hp}[k_0] = \sum_{n=-1}^1 x[n] \cdot g[k_0-n] \\ = x[-1]\cdot g[1] + x[0] \cdot g[0] + x[1] \cdot g[-1],$$ which will result in

$$y_\text{hp}[n_0] = 0 \cdot -1 + -20 \cdot 2 + -50 \cdot -1 = 10.$$

For the rest of the question, you could compute the rest by hand this way. Another quick way is for example documented in these slides, a graphical approach is shown in this video. A Tutorial also featuring continous signals can be found here.

| improve this answer | |
$\endgroup$
  • 2
    $\begingroup$ Please check your second equation, right now it doesn't make any sense. $\endgroup$ – Matt L. Aug 1 '19 at 9:27
  • $\begingroup$ You are right, thank you for pointing it out! $\endgroup$ – Jonas Schwarz Aug 1 '19 at 15:51

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.