FIR Filter
A FIR filter is a type of digital interpolating filter. We will be looking at its use to both distort and interpolate a digital signal as in a CD Player. Mathematically this is done by the following convolution:
Where the term on the left is the filter and the term of the right is you data. So how do we do an infinite sum in a computer? Well we can't because we can't fit an infinite amount of data in a computer, so we have to trim it down. The above sum for the filter is the impulse response of the filter. This is an infinite sum, and for your filter to work exactly as described you would need all of the terms. Since that is not possible you want to keep as many of the most important terms as you can. The most important terms are the ones centered on zero. So if you wanted three terms they would be l = -1, 0, 1 and if you wanted 5 terms etc. Once you have your filter limited to a certain number of terms you can proceed as follows with the convolution.
So the innermost sum from -M to M are the coefficients in you filter. How this actually works is you will be moving down your data point by point, generating a new filtered data point for every unfiltered point you have. The new points will be generated by multiplying the filter coefficients by the unfiltered points before and after where you are in the data stream. So for example if you had three filter coefficients every new filtered data point would be the fist coefficient times the unfiltered data point right before where you are plus the second coefficient times the unfiltered data point where you are plus the third coefficient times the unfiltered data point after where you are. You will notice that all of this is a matrix multiply. So if your unfiltered data is x(m), your filter is h(m), your filtered data is y(m), and you have three filter coefficients it would work as follows.
With m counting up as you move down your data and filter more and more points.