Notes on Digital Signal Processing

My background in DSP is not strong, so in reading Digital Signal Processing: A Guide for Engineers and Scientists (Steven W. Smith, Newnes, 2003), I have made a few notes for my reference. Hopefully they will be helpful to others too!

Linear Systems

To be linear, a system must have the properties of homogeneity (output signal is some constant multipled by input signal), additivity (adding two inputs together gives the same output as adding the two outputs together), and (for most DSP applications) shift invariant (i.e. the system's behaviour does not change if the input signal is shifted). This does not restrict the filter from changing the signal's phase or frequency. The additional property of sinusoidal fidelity states that the system, given a sine wave, will output a sine wave of equal freuquency (but not necessarily same phase, or indeed amplitude).

Impulse Response

The impulse response of a filter (system) is the output signal it gives when the input is a delta function (i.e. first point is 1, all other points are 0). Given the impulse reponse of a filter, this tells us everything about it. When we apply a filter to a particular signal, we convolve the impulse reponse (the filter kernel) with the input signal.

Convolution

Convolution involves taking each point of the input signal, calculating how it can be made from the delta function, and applying that transformation (which is simply a shift and a scaling factor) to all the points in the filter's impulse reponse. This therefore gives n points (where n is the number of points in the impulse response) per input point. These output signals are simply added together to give the final output. The result is an output signal that is the length of the input signal, plus the length of the filter kernel, minus 1, as all the individual output signals overlap with each other (bar the last one).

In a programming context, the calculation of the transformation from the unit impulse (delta function) to any point of the input signal is simply the delta function shifted by the relevant amount (to get the single peak of the delta function to the same x co-ordinate as the input point), and then the value of the input signal is the scaling factor (as the y value of the input multiplied by the y value of the delta function, which is 1, will be the same as the y value of the input signal). This transformation is applied to the filter's impulse response by multiplying each point in the response by the scaling factor (i.e. the y value of the input point), and shifting all the outputted values along by the required amount. When performing a full convolution, because the individual output signals (one per input point) overlap and sum, we can perform the shift portion of the transformation by simply adding the result of our scaling to the variables holding the y values for the output signal points that are the relevant displacement away from the x co-ordinate of the input point. In other words:
output[x + j] = output[x + j] + (input[x] * response[j])
Where for each input point (i.e. different value of x), j counts from 0 to n. Hence, the first point of the scaled response function gets added to the output variable corresponding to the same x co-ordinate as the input, the second is added to the output variable for the output point to the right of that for the 1st input point (i.e. x+1) and so on.

Convolution can be coded up either by looping over each input point, (input side algorithm), or by looping over each output point (output side algorithm). The latter uses the well known form:
output[i] = sum(j=0 to j=m-1) h[j] x input[i-j]
Where there are m points in the impulse reponse (filter kernel).

Decibels

The Bel is a measure of how a signal's power compares to that of a reference signal. One Bel implies a factor of 10 greater power. 20 dB = 2 Bels, which implies a factor of 100 greater in power. -20 dB is therefore a factor of 0.01. Where a reference signal of 1mW into a 600 Ohm load is used, the units become dBm. Note that power is proportional to the square of amplitude, hence if a signal is 100 times more powerful, it will have 10 times the amplitude, compared to the reference signal.