<< Chapter < Page | Chapter >> Page > |
A Matlab program that applies its linear programming function lp.mto [link] , [link] for linear phase FIR filter design is given by:
% lpdesign.m Design an FIR filter from L, f1, f2, and LF using LP.
% L is filter length, f1 and f2 are pass and stopband edges, LF is% the number of freq samples. L is odd. Uses lp.m
% csb 5/22/91L1 = fix(LF*f1/(.5-f2+f1)); L2 = LF - L1; %No. freq samples in PB, SB
Ad = [ones(L1,1); zeros(L2,1)]; %Samples of ideal response
f = [[0:L1-1]*f1/(L1-1), ([0:L2-1]*(.5-f2)/(L2-1) + f2)]'; %Freq samples
M = (L-1)/2;C = cos(2*pi*(f*[0:M])); %Freq response matrixCC = [C, -ones(LF,1); -C, -ones(LF,1)]; %LP matrixAD = [Ad; -Ad];c = [zeros(M+1,1);1]; %Cost functionx0 = [zeros(M+1,1);max(AD)+1]; %Starting valuesx = lp(c,CC,AD,[],[],x0); %Call the LP
d = x(M+2); %delta or deviationa = x(1:M+1); %Half impulse resp.
h = [a(M+1:-1:2);2*a(1);a(2:M+1)]./2; %Impulse response
This program has numerical problems for filters longer than 10 or 20 and
is fairly slow. The
lp()
function uses an algorithm that seems not
well suited to the equations required by filter design. It would be niceto have Meteor written in Matlab, both to show how the Simplex algorithm
works, and to have an efficient LP filter design system in Matlab. Theabove program has been tested using Karmarkar's algorithm
[link] ,
[link] ,
[link] as implemented in Matlab by Lang
[link] .
It proved to be robust and reliable for lengths up to 100 or more. It wasfaster than the Matlab function but slower than Meteor or CPlex. Its use
should be further investigated.
Direct use of quadratic programming and other optimization algorithms seem promising [link] , [link] , [link] , [link] , [link] , [link] , [link] , [link] , [link] , [link]
A very efficient algorithm which uses the results of the alternation theorem is called the Remez exchange algorithm . Remez [link] , [link] , [link] showed that, under rather general conditions, an algorithm that takes a starting estimate of the location of theextremal frequencies and exchanges them with a new set calculated at each iteration will converge to the optimal Chebyshev approximation. Theefficiency of this algorithm comes from finding the optimal solution by directly constructing a function that satisfies the alternation theoremrather than minimizing the Chebyshev error as done by the linear programming technique. The Remez exchange algorithm has proven to be wellsuited to the design of linear phase FIR filters [link] , [link] , [link] .
A particularly useful FIR filter design implementation of the Remez exchange is called the Parks-McClellan algorithm and is described in [link] , [link] , [link] , [link] . It has been implemented in Fortran in [link] , [link] , [link] , [link] and in Matlab in a program at the end of this material. The Matlab program is particularly helpful in understanding howthe algorithm works, however, because it does not use any special tricks, it is limited to lengths of 60 or so. Extensions and details can be foundin [link] , [link] , [link] , [link] , [link] , [link] , [link] , [link] , [link] , [link] , [link] . This is a robust, efficient algorithm that significantly changed DSP whenParks and McClellan first described it in 1972 and has undergone important improvements. Examples are illustrated in [link] , [link] .
Notification Switch
Would you like to follow the 'Digital signal processing and digital filter design (draft)' conversation and receive update notifications?