# Berchin's FDLS arbitrary filter design algorithm

I'm trying to use Berchin's FDLS methods (for those that don't know what it is, it's a way to design arbitrary magnitude and phase of an IIR Eq)

I tried different things but neither gave me what i asked:

1. I tried to design an allpass filter with arbitrary phase response (nothing fancy just a linear phase and a short deviation for 5 points) and it didn't worked as planned. Actually what i want to do is to counter the phase change of an IIR filter

2. I tried a linear phase response for a $-12\textrm{ dB}$ notch and the same way it didn't worked (in black the desired response) I used a samplerate of $316$, $M=158$ points and a filter order of around $50$.

Do I need to use more points to increase the filter order or is it just impossible to design my filters using that algorithm?

• @PeterK.: Although it is brief, you might consider making that an answer. Since the OP seems to have disappeared, there probably won't be any better resolution to the problem. – Jason R Sep 22 '13 at 23:59
• @JasonR: Done! And set to Community Wiki. – Peter K. Sep 23 '13 at 14:59

## 3 Answers

FDLS requires a causal frequency response. Your prototype frequency response has zero phase everywhere, which is most definitely not causal.

An IIR filter order of 50 is humongous. When FDLS has too many poles and zeroes available, it "tries" to cancel excess poles with excess zeroes. Unfortunately, due to numerical limitations, the cancellation is often pretty poor. For your notch filter, try 2nd or 4th order numerator and denominator, after making the response causal.

Though (number of measurements) = (number of coefficients) = [(numerator order) + (denominator order) + 1] is mathematically sufficient, I find that FDLS likes many more measurements than that. I recommend an absolute minimum of twice as many measurements as coefficients, and prefer 5x to 10x.

Greg Berchin

I haven't used the technique, but an IIR filter order of 50 sounds remarkably high, and possibly prone to numerical problems. Try starting out with much smaller values for M and filter order, and slowly ramping them up. The paper you quote uses $M=8$ and $N=9$.

With FDLS, another parameter to play with to find alternate solutions is the ratio of zeros to poles, as well as the total. IIRC, more of both isn't always better (possibly for numerical reasons).