| # Filter Design LP and QP > Applications > Back | Filter design Finite impulse response filters A design problem LP formulation ## Finite Impulse Response filters ### Filters A singel-input, single-output filter is a dynamical system, with input a signal with values in , and output another signal with values . Here stands for the (discrete) time variable. ### Finite impulse response filter A finite-impulse response (FIR) filter is a particular type of filter which has the form The vector is called the impulse response of the filter. Its name derives from the fact that the response of the filter above to the so-called impulse is precisely the finitely supported signal ### Frequency response The Fourier transform of the impulse response is a complex-valued function with values This function is of importance, since it dictates how the filter responds to periodic signals. Precisely, if the input is a complex exponential , then the output will be the scaled complex exponential . Example: Moving average filter. An example of a FIR filter is a moving average filter. The moving average filter of length is of the form ### Linear-phase FIR filters Linear phase FIR filters turns out to be simpler to design. Such filters involves an odd number of taps: , with an impulse response that is symmetric around the midpoint: The qualifier linear phase comes from the fact that, for such filters, the frequency response bears the form where is the {em real-valued} function with values Hence, the phase of the complex number is a linear function of . ## A design problem A design problem involving FIR filters typically involves the FIR filter's impulse response as a variable. The goal is to adjust the response of the filter under a variety of inputs. For example, we would like to ensure that the filter rejects high-frequency signals, but amplifies low-frequency ones to a certain degree. These two requirements involve the magnitude of the filter's frequency response. Stop-band constraint: the first constraint may look like where is a ‘‘stop-band’’ frequency bound and corresponds to an attenuation level we seek to achieve at high frequencies. Pass-band constraint: The second constraint may look like where is a ‘‘pass-band’’ frequency bound and corresponds to a lower bound on the amplification level that we seek to achieve at low frequencies. The first constraint is convex in the design variable . The second is not. In addition, both constraints actually involve an {em infinite} number of constraints, one for each frequency . ## LP formulation ### Issue of non-convexity To address the issue of non-convexity, we restrict our search for filters, to filters that are linear-phase. In that case, the magnitude of the frequency response can be written as where now is a real number. Without loss of generality, we can choose the impulse response vector to be such that . Then the pass-band constraint becomes which is now convex in the design variable . In fact, it is an infinite number of affine inequalities, of the form The stop-band constraint is also an infinite number of affine inequalities: ### Frequency discretization To address the issue of an infinite number of constraints, we simply discretize the frequency domain. Instead of enforcing the constraints for every frequency in an interval, we simply enforce them on a finite set inside the interval. Let use choose a finite set of frequencies , that belong to the high-frequency region . The stop-band constraint is now approximated by the {em finite} number of affine inequalities in : Likewise we choose another set of frequencies , that belong to the low-frequency region . The pass-band constraint is also approximated by a finite number of affine inequalities in : Together, the constraints can be written as , where is a polytope. ### Variant: pass-band ripple minimization A variant for the above is to consider both a lower and upper bound on the low-frequency response. Often it is desirable to have a low pass-band ripple, which is a measure on the “flatness” of the frequency response's magnitude at low frequencies. A ripple level of is enforced via the constraint
| A linear-phase filter which minimizes the minimizes the maximum pass-band ripple, with a constraint on the maximum stop-band attenuation. The image shows the impulse response of the optimal filter.
| A linear-phase filter which minimizes the minimizes the maximum pass-band ripple, with a constraint on the maximum stop-band attenuation. The image shows the frequency response of the optimal filter, with the magnitude on top and phase on the bottom.
### Trade-off curves Based on these constraints, we may plot the trade-off curve between high-frequency attenuation against low-frequency amplification.