FIR Filter

From Class Wiki
Jump to navigation Jump to search

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 on 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 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.


Where h is your filter coefficients and x is your data. How this actually works is you will be moving down your data point by point, generating a new filtered data point, y, for every unfiltered point, x, you have. The new points will be generated by multiplying the filter coefficients with the unfiltered points before and after where you are in the data stream. 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 just 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. This is a filter that could be used in a CD Player to pre-distort and interpolate a signal.


Principle author of this page: Sam Barnes