# Resonators

## Introduction

A resonator is a digital equivalent of a tuned circuit. There are three varieties:
- the
*bandpass* resonator, which has a
high gain at its centre frequency and low gain elsewhere;

- the
*bandstop* resonator (or *notch filter*), which has zero gain (-inf dB) at its centre
frequency and about unity (0 dB) elsewhere;

- the
*allpass* resonator, which has unity gain (0 dB) everywhere, with a phase shift which varies
with frequency.

The phase response of the bandpass resonator approximates to +pi/2 at frequencies below the centre and
-pi/2 at frequencies above the centre, and is exactly zero at the centre. The bandstop and allpass resonators
both have approximately zero phase shift except at the centre frequency, at which the phase shift is
nominally ±pi; however in the case of the bandstop resonator, since the gain is zero at the centre
frequency, the phase shift at that frequency is not defined.
In both respects (magnitude and phase) the resonator behaves like a ``real'' analogue tuned circuit.

If you want a narrow bandpass or bandstop filter, a resonator is often more efficient and better behaved
than a traditional (e.g. Butterworth) filter.

## Design

All types of resonator are designed directly in the *z*-plane. The bilinear transform
is not used here. A bandpass resonator is constructed first; if you asked for one of the other
types, the bandpass resonator is transformed accordingly.
The number of poles is fixed at 2,
initially at *z* = *r* exp ±j theta, where *r* is close to 1.
Two zeros are added at *z* = ±1, to ensure zero response at d.c. and h.f.

The presence of the conjugate poles affects the response slightly: the ``correct'' pole
positions are not exactly where you would expect them to be. Consequently,
the initial pole positions are next refined iteratively, to place
the peak as close as possible to where you said you wanted it.

If you asked for a bandstop or allpass resonator, the zeros at *z* = ±1 are
then removed. For a bandstop design, new zeros are added on the unit circle at *z* = exp ±j theta,
where theta is the *unrefined* initial value of theta. This gives a zero response at
the precise centre frequency. For an allpass design, zeros are added at (1/r) exp ±j theta,
where theta this time is the *refined* value, to balance the existing poles.

Tony Fisher /
fisher@minster.york.ac.uk