Let's now look at FIR design methods. FIR filters, as we said, are a digital signal processing exclusivity and so are the algorithms to design them. In the case of FIR filters, the rational transfer function is no longer a ratio of polynomials, but just one polynomial Z. So optimization procedures do exist that can achieve optimal results for a given set of specifications. In the 70s, Parks and McClellan developed an algorithm to design optimal FIR filters that yields filters with linear phase and that have equiripple error both in passband and stopband. The algorithm proceeds by minimizing the maximum error in passband and stopband of the transfer function. Linearity of the phase is achieved by designing an impulse response, which is either symmetric or antisymmetric. We end up with four types of filters according to whether the impulse response is even length or odd length and symmetric or antisymmetric. Type I filters, probably the most common, have an odd length impulse response, and they are symmetric around the center tap. Type III filters have an odd number of taps, they're antisymmetric around the center tap, which imposes, of course, the center type is zero. Type II and Type IV filters are symmetric and antisymmetric filters, respectively, both of which have an even number of taps. That means that the center of symmetry of these filters fall in between samples. And so they both introduce a non integer linear phase factor, of one half sample. Let's look in more detail at the phase properties of a Type I FIR filter. A Type I filter is an odd length symmetric FIR, so it will look maybe like this. Where the taps are symmetric around an index, capital C. The symmetry relationship can be simplified if we shift the filter so that the center tap falls in zero. So we define an auxiliary filter, h1[n], which is simply h[n + C] and this filter now, will be centered in 0 and symmetric around 0. We can express that by saying that h prime of n is equal to h prime of minus n. The relationship between h prime and h in the z domain is simply multiplication by z to the minus capital C. If we will now compute the Z-transform of the H prime of n, we have the sum for n that goes from minus capital M to M of each prime of n times z to the minus n. Because of the symmetry, we can isolate the center tap, h prime of 0 and then, write the rest of the summation by collecting equal terms. And so we have the sum for n that goes from 1 to capital M of h prime of n that multiplies z to the n plus z to the minus n. If we now replace z with e to the j omega, we get the Fourier transform of H prime. Which is simply h prime of 0 plus this sum for n that goes from 1 to capital M of h prime of n, then multiplies e to the j omega n plus e to the minus j omega n. But we know that this is simply twice the cosine of omega n, and so we obtain that the Fourier transform of h prime of n is purely real. And this means that the Fourier transform of h prime of n is zero-phase. We can get the Fourier transform of h of n as simply the zero phase before you transform times a linear phase factor e to the minus j omega C. So we have proven that type one filters doing it possessed linear phase. A similar proof can be carried out for the other three types of linear phase FIRs. Let us now look at the Parks-McClellan design algorithm also known as the Minimax filter design algorithm. The magnitude response of the filters designed by this algorithm is equally for both in the passband and the stopband. The designed parameters are the order which in this case corresponds to the number of taps. We also specify the passband edge omega p and the stopband edge omega s. So we specify the width of the transition band and we specify the ratio of the passband to stopband error which we call delta of p over delta of s. Note, we are not specifying the absolute error which means we can weigh the importance of the error by privileging the passband or the stopband. We run the algorithm and we obtain a filter that we have to check against the maximum passband and stopband error specified in the requirements. If the error in either band exceeds the requirements of the specs, then we have to increase the order and run the algorithm again. The frequency response of the Minimax filter looks like this. It's a typical equiripple characteristic, and you can see the extreme of the frequency response all touch the edge of the tolerance regions, both in passband and stopband. This is designed for a nine tap filter, with a transition band between 0.25 pi, and 0.3 pi. We can increase number of taps to 19 for the same transition band and we can see that get steeper transitions and lower errors in passband and stopband. And we can go up to say 51 taps, we get something that's actually quite good with a very small error in passband, almost undetectable errors in stopband and steep transitions. A good way to compare the performance of different filters is to express their magnitude in decibels. So if we say that G is the maximum magnitude in the passband, the attenuation of the filter expressed in decibels is 20 times the log in base 10 of the magnitude of the frequency response divided by the maximum gain. With this notation we can plot the frequency response of the fourth-order elliptic low-pass and we can see that it has an attenuation of about -30 dBs in the stop band. A comparable FIR filter, comparable in the sense of computational cost, is the nine tap minimax. And we see that for that computational cost we get an attenuation that is definitely less because it's on the order of 10 dBs, approximately. To get a performance comparable to the elliptic filter, we have to increase the length of the filter to 19 taps at least. And here, we hit the approximate 30 dB mark. The 51-tap filter that we saw before has actually a very, very good attenuation. It's about 90 dBs. But of course, there's price we pay is now negligible in terms of the number of operation per output sample. Finally as mentioned before, we just concentrated on lowpass prototypes but of course we can use any of these designs to obtain bandpass and highpass filters as well. Optimal FIR bandpass and highpass filters can be designed directly with the Parks-McClellan algorithm. You can also design optimal FIR with piecewise linear magnitude responses, so something that for instance goes like this. The literature on filter design is really really vast and we just scratched the surface. It is a very fascinating topic that has occupied researchers for many years, and keeps them occupied to this day.