I would like to calculate the amplitude response $|H(z)|$, $z=e^{j\omega}$, of the following filter:


and I would like to avoid using Euler's formula and complex numbers cartesian form as much as possible.

  • 1
    $\begingroup$ Since you don't want to use math (complex numbers are a misnomer-- it doesn't make it more complex to solve but much easier!) then use freqz in your choice of Matlab, Octave or Python scipy and that will give you the amplitude response $\endgroup$ Jun 17 '20 at 2:56

The given transfer function has a specific form. With the denominator polynomial $A(z)=2+bz^{-2}$, you can write the transfer function as


Since for $z=e^{j\omega}$ (i.e., on the unit circle, where we evaluate the frequency response), we have $|A(z)|=|A(z^{-1})|$, the magnitude of $H(e^{j\omega})$ is given by


The given filter is a (scaled) all-pass filter. It's easy to recognize all-pass filters by noting that their numerator and denominator polynomials have mirrored coefficients.

  • $\begingroup$ Nice Matt, didn’t catch that! $\endgroup$ Jun 17 '20 at 13:01
  • $\begingroup$ Really Nice. Thanks a lot. $\endgroup$
    – mamado
    Jun 24 '20 at 7:48

I am not sure how one would avoid complex math or why one would want to given the simplification complex math provides (an oxymoron due to poor naming or perhaps to scare those that don't know yet how easy it is away) but perhaps the graphical explanation can help provide further intuitive insight.

First some necessary background: $z$ is the domain of all complex numbers, meaning $z$ itself can take on any complex number (therefore it is the plane of all complex numbers). But the frequency response is found when you only use the unit circle for $z$. Meaning a circle on the complex plane, centered on the origin, that has a magnitude of 1. Mathematically, this is given as $z= e^{j\omega}$ where $\omega$ represents frequencies from $0$ to $2\pi$, or if we prefer $\pm\pi$, where the sampling rate $f_s= 2\pi$ (in units of radians per sample, hence the reason for $\pi$ showing up. Each point on this unit circle represents a different frequency between $f=0$ or "DC" and the sampling rate with $f=2\pi$.

The term $e^{j\omega}$ is a phasor that has a magnitude of 1 always, and an angle given by $\omega$.

So we use $z= e^{j\omega}$ to get the frequency response which will include both the magnitude and phase for all points $\omega$. Thus the magnitude response is often expressed as $|H(e^{j\omega})|$, showing that we are making this substitution for $z$. Likewise $z^{-1}= e^{-j\omega}$ and $z^{-2}= e^{-j2\omega}$ etc. Notice what is occuring here: raising $z$ to the $-1$ power results in a phasor that has a magnitude of 1 and rotates clockwise as the frequency goes from $0$ to $2\pi$ (as the angle is increasingly negative), and raising $z$ to the $-2$ power results in the phasor rotating twice.

So now observe the numerator in the OP's expression for $H(z)$, which is $b/2+ z^{-2}$. This is graphically depicted below on the left, on its own as a phasor of magnitude 1 rotating clocwise twice (the $z^{-2}$ term) added to a phasor of magnitude $b/2$ and angle 0. (The $b/2$ does not rotate as we sweep the frequency but the $z^{-2}$ term does.) The net result of this summation is the phasor with the dashed line, here shown when the frequency is approximately at $\pi/8$. That dashed line has the magnitude and phase of the numerator at that particular frequency, and for purpose of computing the magnitude of $H(e^{j\omega})$, the phase will be of no consequence. Since the rotating phasor in the picture is given by $z^{-2}$, it will have rotated twice as the frequency is swept from $0$ to $2\pi$. For example, when the frequency is at half the sampling rate, which is given as $f=\pi$, the rotating phasor will have rotated $-2\pi$ or be back at angle 0 (for a numerator magnitude of $1+b/2$ at that frequency).

The denominator is formed the same way, thus overall resulting in a numerator mangitude divided by a denominator magnitude to give the final magnitude of $H(e^{j\omega})$ for each frequency value $\omega$ between $0$ and $2\pi$.

complex phasors

  • $\begingroup$ Note that for the given transfer function there's indeed a very quick and simple way to see its magnitude response. $\endgroup$
    – Matt L.
    Jun 17 '20 at 6:41

Use fvtool and freqz in Matlab.

b=[0.5b 0 1];
a=[2 0 b];

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.