AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Scilab fir filter design2/19/2023 ![]() This must be a disadvantage, right? You bet. So, an IIR filter costs far less than a FIR in terms of instructions per second or logic gates. The FIR variant required 10 multiplications per sample, where the IIR version needs only two. Look again at the moving average example. An IIR must be more powerful than a FIR, but what are IIR filters’ advantages compared to FIR filters? Thanks to the feedback mechanism, the same filtering performance could be achieved with much fewer calculations. If you think about it, a FIR is a specific type of IIR, with all feedback coefficients set to zero. Store the N previous input samples and the previously calculated output values in a circular buffer, multiply each buffer entry with a corresponding numerical constant at each time step, and sum them all to get the new output value. The principle is still the same simple algorithm. This provides an IIR filter’s generic form (see Figure 5). There is nothing to prevent you from using the same method but with a larger number of previous input and output values, not just the last one of each. But think about it, you could build more complex filters by adding more parameters. In this basic example, the output signal is calculated with only the last input and output values, multiplying each of them by a given constant and summing the results to get the new output value. Simply increase the x factor for a lower filtering factor, or decrease it to have a stronger filter. The corresponding algorithm is shown in Figure 3.įigure 4 shows this type of filter on a noisy sine signal with x = 0.2. Instead of calculating the last 10 input values’ average, which is a FIR, you could calculate a moving average by adjusting an already calculated average based on the next input value. Let’s go back to the example of a moving average filter. As a consequence, an input change may influence the output for a long, theoretically infinite, time. Rather than just using the previous input values, an IIR filter calculates the next output value based on the previous input values and the previously calculated output values (see Figure 1b). An IIR filter uses a slightly more complex, but more powerful approach. That’s a kind of FIR filter, as the new output value is calculated as a linear combination of a fixed number of previous input values, here 10. Its algorithm would look like what is shown in Figure 2. For example, you can build a moving average filter by calculating the average of the last 10 input values. In practical words, a FIR filter takes the N previous input samples and uses them to calculate the next output value (see Figure 1a). As indicated by the article title, this type of FIR filter has a finite “memory” over time. The simplest one uses the FIR filter presented in my 207 article. However, as an efficient time machine has yet to be invented, at a given time step, a real-time digital filter must calculate the next output value based only on older values. As we live in a digital world, this data flow is a discrete-time signal (i.e., its successive values represent the signal value at discrete time steps). A digital filter is a piece of software, firmware, or logic circuit that takes a digital data flow as an input and provides a filtered version of this signal on its output. In this article, I will use the much-loved “soldering iron language” to show that IIR filters are similar to classic analog filters. ![]() One of the difficult things about IIR filters is that they are usually presented through exotic mathematical concepts (e.g., poles and zeros placement, Z-transforms, etc.) While these methods are invaluable, I want to explain the basics of IIR filters using simple words, math, and electronic concepts. Time has passed, and now I will try to fulfill your requests. ![]() I found it difficult to present IIR filters in a short article, probably because I was not familiar enough with them. Two of you asked me to write something about the other kind of digital filters-the so-called infinite impulse response (IIR) filters. I received five or six e-mails after it was published. My second Darker Side article was about finite impulse response (FIR) digital filters (“No Fear with FIR: Put a FIR Filter to Work,” Circuit Cellar 207, 2007). Over these five years, the great feedback and e-mail discussions with you, Circuit Cellar readers, have motivated me to continue! Moreover, my article topics are often inspired by readers’ comments. I am delighted to still be in front of my keyboard five years later. At that time, I thought I would have interesting electronics engineering topics to share with you for a year, maybe two. I started this column in August 2007 (“Let’s Play with EMI!,” Circuit Cellar, 205). ![]()
0 Comments
Read More
Leave a Reply. |