Wednesday, May 20, 2009

Life Stories #1 - Designing a Decimation Filter with MATLAB, without the Filter Design Toolbox

I am working through the activities in the book "What Color is Your Parachute?" by Richard Nelson Bolles. Part of this effort is to write seven stories about a goal that I wanted to accomplish, and what I did to accomplish it. I decided to start with a recent story. It is titled:

Designing a Decimation Filter with MATLAB without the Filter Design Toolbox

About a year ago, I had a goal to create a better decimation filter for a particular product. This product had an over-sampling system, where eight electrical signals were sampled at a rate 8x higher than needed, and decimated to the desired target rate.

At the time, I understood the basics of FIR filter design, but I never actually designed or implemented an FIR filter. Being a lifetime-learner, and a having a “no fear” approach to software, I attempted to design the filter using only my basic knowledge of FIR filtering, a copy of “Understanding Digital Signal Processing” by Richard Lyon, occasional advice from a seasoned DSP pro, and an abundance of “stick-to-itiveness”.

In summary, I designed the filter as a two stage FIR decimation filter. The first stage reduced the sampling rate by a factor of 4x and the second stage reduced the sampling rate by a factor of 2x. A single FIR filter would have required 96 taps to properly band-limit the signal for decimation. A two-stage FIR filter reduced the required filter taps to only 66 taps total.

I created the filter by modeling the frequency response of the front-end analog filter with a Butterworth filter design in MATLAB. Then, I inverted the frequency response over the bandwidth of interest, and I equalized the frequency response to reduce the attenuation of the hardware filter over the target bandwidth.

I added the frequency response of the equalization to the frequency response of the first stage of the FIR filter, and I used the “fir2” function with a Chebyshev window to design the first stage of the FIR filter. I experimented with the number of coefficients until I had the desired frequency response for the first stage of the decimation filter.

Next, I used the same process to generate the coefficients for the second stage of the filter (i.e., determine the combined frequency response of hardware filter and the first stage analog filter, inverse this response over the bandwidth of interest, adjust the desired frequency response for the proper stop band, and use the “fir2” function to generate the filter coefficients).

Finally, I implemented the filter function in C and added the two stages of filtering to the product. During the source code implementation, I created a set of unit tests, using CUTEST, that verify the functionality of the two-stage decimation system.

The result is a decimation system that equalizes the target passband. Analysis showed that the new decimation system is much better that the old-boxcar approach. The filter, in combination with the analog front-end filter and the system gain, provides full gain over the target passband and –100 dB of attenuation at the Nyquist frequency.

A series of frequency response tests provided that the two-stage decimation filter reduced the aliasing significantly in both the real-world system testing and unit testing. It accomplished this without reducing the target bandwidth for the system.

Wednesday, May 13, 2009

Starting to Build a Network

Send an e-mail to Raven Software. They made some great game titles, like Hexen and Heretic. These are two games I loved to play back in the 90's. I never realized they were right here in Madison, Wisconsin. Trying to get an informational interview with one of the software developers on their staff, just to see if it would be a good fit with me.

Game development is one of the reasons I became interested in computer programming back in junior high school. I wrote one of my first programs in assembly for the Vic-20. It was a game similar to Centipede. What a blast!

Tuesday, May 5, 2009

Phase One: Reconnaissance

Emory Mascott
How do find a job in a new city when you live 800 miles away? When you know that answering adds using Dice and Monster only has a 4% success rate? The answer is research, reconnaissance and networking.

I traveled to Atlanta last weekend on a reconnaissance mission. The trip had four phases:

1. Visit Emory University and see if it would be a good fit for my wife. Network with the staff if possible.
2. Visit Georgia Tech. Talk with the faculty about corporations in the Atlanta area that share my fields of interest.
3. Visit a local elementary school and take a tour. See if it will be a good fit for Logan and Zoe.
4. Look at the Decatur area, and see if it would be a good fit for the family.

The visit was a success; however, I was unable to make any contact with the engineering departments at Georgia Tech or Emory. It seems that I went on the trip during the one week between the end of classes and the start of finals, where the entire faculty is off campus or in all-day meetings.

Next step is to complete the self assessment from "What color is your Parachute", start arranging informational interviews and start looking at corporations in the Atlanta area.