Least-squares digital IIR filter design (with arbitrary responses) I'm studying the IIR filter design that is described in the book: Algorithms for the constrained design of digital filters with arbitrary phase and magnitude responses. 

You can get the code at page 171 (at least the main function), and here is an example of a filter design :

M=4;
N=4;
tau=5;
om=pi*[linspace(0,0.2,20),linspace(0.4,1,60)];
D=[exp(-1i*om(1:20)*tau),zeros(1,60)];
W=ones(1,80);
[b,a,e]=mpiir_l2(M,N,om,D,W,0.98);


This is the design of a pass-band linear phase lowpass filter



There is something I don't understand in this code: exp(-1i*om(1:20)*tau) is a way to create regularly spaced points with constant phase change and magnitude = 1. But I don't understand the parameter tau. I tried to change that parameter and I had totally different results: like a notch instead of a lowpass.


How do you choose that number ? 
I have to design my filters according to the user desire but how to guess that parameter? 
And also how to you choose the phase angles shift ?


Jeff
Well, let's decode it:

om=pi*[linspace(0,0.2,20),linspace(0.4,1,60)];


om is a variable that ranges from 0 to pi with two different spacings (one from 0 to 0.2*pi and one from 0.4*pi to pi.

Then, to find D (the desired response), we do:

-1i*om(1:20)*tau


This takes the first twenty entries in om and multiplies them by tau and -i1 = $-\sqrt{-1}$.

That makes the frequency range (D in the above) from 0 to 0.2*pi*tau (i.e. pi since tau is 5). 

Checking page 171, we see:

om frequency grid 0&lt;=om&lt;= pi
D complex desired frequency response on the grid om


which means that om has to be between 0 and pi, and D is the desired response.

If you've changed tau, causing D to have a greater phase (more delay).

What I suspect is happening is that the phase (and, therefore, the delay) you've changed it to cannot easily be approximated by a $4^{\rm th}$ order filter (N or M in your script).