# Digital Signal Processing/Impulse Response

Let's say that we have the following block diagram:

*h[n]* is known as the '*Impulse Response* of the digital system. We will talk about impulse responses here in this chapter.

## Impulse Function edit

In digital circuits, we use a variant of the continuous-time delta function. This delta function (δ*[n]*) has a value of 1 at *n = 0*, and a value of 0 everywhere else.

δ[n] = [... 0 0 0 0 1& 0 0 0 0 ...]

If we set *x[n] =* δ*[n]*, then the output *y[n]* will be the response of the system to an impulse, or simply, the "Impulse Response".

We can time-shift the impulse function as such:

δ[n-1] = [... 0 0 0 0& 1 0 0 0 0 ...] δ[n+1] = [... 0 0 0 0 1 0& 0 0 0 ...]

We can add time-shifted values of the impulse function to create an **Impulse Train:**

y[n] = δ[n] + δ[n-1] + δ[n-2] + δ[n-4] y[n] = [1& 1 1 0 1]

## Impulse Trains edit

## Impulse Response edit

If we have a difference equation relating *y[n]* to *x[n]*, we can find the impulse response difference equation by replacing every *y* with an *h*, and every *x* with a δ:

y[n] = 2x[n] + 3x[n-1] + 4x[n-2] h[n] = 2δ[n] + 3δ[n-1] + 4δ[n-2]

And by plugging in successive values for *n*, we can calculate the impulse response to be:

h[n] = [2& 3 4]

## Output edit

Now, let's say that we have a given impulse response, *h[n]*, and we have a given input *x[n]* as such:

x[n] = [1& 0 1 2] h[n] = [2& 2 2 1]

We can calculate the output, *y[n]*, as the convolution of those 2 quantities:

x[n] -> 1& 0 1 2 h[-n] -> 1 2 2 2& h[-n-3] -> 1 2 2 2& -> y[m-3] = 2& h[-n-2] -> 1 2 2 2& -> y[m-2] = 2 h[-n-1] -> 1 2 2 2& -> y[m-1] = 4 h[-n] -> 1 2 2 2& -> y[m] = 7 h[-n+1] -> 1 2 2 2& -> y[m+1] = 6 h[-n+2] -> 1 2 2 2& -> y[m+2] = 5 h[-n+3] -> 1 2 2 2& -> y[m+3] = 2 y[n] = [2& 2 4 7 6 5 2]