Insight of Z plane pole/zero behaviour – realliZation

02/01/2013 § Leave a comment

Following my hunch of visualizing a 2nd order IIR digital filter has led me to discover something new.
I am not sure if this the first time a filter is being designed this way but anyway.. I am enjoying it. 🙂

The Idea
Herein, zeros are used interchangeably with complex conjugate zeros and poles are used interchangeably with complex conjugate poles.
In figures below, ‘blue dots’ are zeros and ‘red diamonds’ are poles
In a z plane, zeros/poles attenuate/boost the closest frequencies which are mapped on upper half of unit circle, everyone knows that. But there is more to it than just that.

A few observations:
For a filter we are generally concerned about 3 things:
1. Center frequency
2. Bandwidth
3. Attenuation or Boost

For Center Frequency:
As you expected, its just 2*pi*(center freq. in Hz) / (sampling freq in Hz)

For Bandwidth:
1. If the angle between complex conjugate pairs of zeros (or poles) is not 180 degrees. The range of frequencies which will mapped on shorter arc will be attenuated (or boosted) more in comparison to range if frequencies mapped on bigger arc. See fig, 1 (for zeros, attenuation) and 2 (for poles, boost)

unbalanced zeros in Z plane

Fig. 1

unbalanced poles in Z plane

Fig. 2

2. To balance the attenuation (or boost) use a pair of complex conjugate poles (or zeros) as shown in fig 3. We will call these poles (or zeros), ‘balancing poles (or zeros)’

balanced poles and zero in Z plane

Fig. 3

3. Suppose you want to have constant bandwidth and constant attenuation (or boost). The radius of zeros (or poles) and the radius of balancing poles (or zeros) will not change. But as the center freq. changes the angle between zeros (or poles) and the radius of balancing poles (or zeros) will change. And will be inversely proportional to abs (pi/2 – center frequency in radians). That means when center freq. will be 1/4th of sampling freq.(ie, pi/2) the angle between zeros (or poles) and the balancing poles (or zeros) will be 0.

For Attenuation and Boost:
Zeros attenuate, everyone knows it. But I noticed a ‘strange’ behavior in attenuation (apart from the unbalance attenuation I talked about above). For a given center freq. attenuation is max when zeros are exactly on unit circle at an angle of 2*pi*(center freq. in Hz) / (sampling freq in Hz). BUT, as the center freq. sweeps from min. to max (or from 0 to pi radians) attenuation is max at 0 radians decreases till pi/2 and then increases to max as it approaches pi. This might not matter much because the ‘minimum’ of this attenuation (at pi/2) is still around 40dB, good enough for audio processing (?).

Same is the behavior with poles, of course, you don’t want put poles on unit circle or beyond it for obvious reasons.

Mathematical formulation:
Like I said my aim *was* to visualize 😛
And now that I can ‘see’ things happening, I don’t have a mathematical model.
I am working at it. I am trying to juggle between my day job, DSP and my favorite open source project Mixxx.
So everything has its time share and often gets preempted by day job 😛

The Tool
Its very difficult (at-least without guidance of a DSP veteran) to observe this behavior using standard tools like Matlab/Octave.

So I made my own tool, called Reallization. Following is a seak peek insight to architecture of reallization. The idea was to follow something like a SuperCollider architecture and I also borrowed some other ideas from Ross’s blog post.
1. 3 independent threads
– For user interface
– A real time priority thread for Portaudio callback.
– A thread to buffer audio data from disk for Portaudio to playback using libsndfile.

2. The communication between threads is via a non blocking FIFO. Every time realtime audio thread wants data, it reads a frame from audio buffer and updates the filter coefficients from a FIFO which is updated by GUI.

3. If I have not yet mentioned, coding is in C++/Qt and here is the source code.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

What’s this?

You are currently reading Insight of Z plane pole/zero behaviour – realliZation at a tryst with DSP.

meta

%d bloggers like this: