datasheets.com EBN.com EDN.com EETimes.com Embedded.com PlanetAnalog.com TechOnline.com  
Events
UBM Tech
UBM Tech

Design Article

Synthesize FIR filters using high-school algebra (Part 2)

Kendall Castor-Perry, Cypress Semiconductor

3/19/2012 11:09 AM EDT

Filter example

Now for a real example. Let's say that I want very high attenuation between around 49 Hz and 51 Hz, again between 59 Hz and 61 Hz (i.e. the system must be able to reject both commonly-used AC line frequencies without change of coefficients or sample rate), and finally also between 98 Hz and 102 Hz. I'll specify 220 Hz as the sample rate to ensure that the 2nd harmonic of 60 Hz aliases round and falls right into that same hole that the 50 Hz second harmonic does (homework, if you can't see why that happens).

So, what happens if I just build a filter that has nulls at these six frequencies? It's simple to make up a spreadsheet that calculates the z coefficient shown in equation [8] for a set of frequencies, and multiplies them up into a single polynomial. The six frequencies create six quadratic factors, shown in Table 1.

Table 1: Six quadratic factors, calculated for specific null frequencies

When multiplied together (equation [9]), these six quadratic factors produce a twelfthorder polynomial (equation [10]).

The frequency response of this filter is shown in Figure 3, straight out of Excel. For the intended application, it's actually already a pretty good filter, “straight out of the box”, and it has no wasted coefficients at all!

Figure 3: The frequency response of the filter defined by equation [10]

Let's take a closer look at the region around 50 Hz and 60 Hz in LTSpice. Yep, those nulls are indeed where we wanted them to be – see Figure 4. Now, it's easy to play around with this approach using the spreadsheet, adding and moving nulls until you get exactly what you want.

Not all combinations of null frequencies will necessarily produce a response that you're happy with first time round. You'll find that as you try to push the stopband of a lowpass filter well below fs/4, for example, you'll need to add extra nulls above this frequency to 'pin the stopband down'. It's an empirical way to proceed, for sure – but you certainly get a feeling for what's going on with these nulls.

Figure 4: Up close and polynomial; nice notches just where we asked for them

If you want a filter with an even number of taps, you can multiply in an extra linear term of (z+1), which has the effect of putting a null at fs/2 (which gives us some extra stopband rejection). That's something we can deduce from one of those earlier special cases; if a function Q(z)=(z+1)*(z+1) has a null at fs/2, so must its square root.





Frank Eory

4/3/2012 6:04 PM EDT

Thanks for this great article Kendall. I see now why you bothered factoring -- it does provide good insight into which coefficients create which zeros.

Sign in to Reply



Please sign in to post comment

Navigate to related information

Datasheets.com Parts Search

185 million searchable parts
(please enter a part number or hit search to begin)