4
$\begingroup$

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

enter image description here

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

$\endgroup$
2
$\begingroup$

The variable tau was chosen so that the phase of D at $om = 0.2$ is $-\pi$.

It is easier to understanding what is going on if you plot D, which is the desired magnitude/phase response of the filter. Add the following code to help you visualize what is going on:

figure(1);
subplot(2,1,1);
  plot(om/pi,10*log10(abs(D)+realmin));
  title('Magnitude Response');
  xlabel('Frequency (normalized)');
  ylabel('Magnitude (dB)');
  axis([0, 1, -80, 10]);
subplot(2,1,2);
  plot(om/pi,angle(D)*180/pi);
  title('Phase Response');
  xlabel('Frequency (normalized)');
  ylabel('Phase (degrees)');
  axis([0, 1, -180, 180]);

When you look at the resulting plot, you can see that the current value of tau gives a phase response which dips down to $-180^\circ$ at the cutoff frequency. Notice that the phase will wrap back around from $-180^\circ$ to $180^\circ$. This will almost always lead to undesired results in a system.

$\endgroup$
3
$\begingroup$

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<=om<= 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).

$\endgroup$
  • $\begingroup$ Changing the value of tau does not actually affect the value of om. $\endgroup$ – nispio Aug 23 '13 at 17:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.