Z Rocks!!

First, the background:

Euler's Identity: ej&omega = cos(&omega) + j sin(&omega)

where j = sqrt(-1) and ln(e) = 1

Some cool consequences of Euler's Identity:

And now... The Star of Our Show:

Z = ej&omega

There is much we can do with Z. For example:

Making discretely sampled sine waves from Z:

let &omega = &pi/4

Successively raize Z to higher powers:
(successively multiply the prior sample result by Z):

Z0
=
1.0
Z1
= ej&pi/4 =
0.707 + 0.707j
Z2= ej&pi/2 =j
Z3
=
-0.707 + 0.707j
Z4
=
-1
Z5
=
-0.707 + -0.707j
Z6 =
=
-j
Z7 =
=
0.707 - 0.707j
Z8 =
=
1.0
etc.etc.etc.

So this complex "Phasor" generates a real cosine wave
and an imaginary sine wave at 1/8 the sample rate.
This is also called a "quadrature oscillator."

We can get the cosine by taking the real part:

cos(&omega t) = Re[e&omega t]

and the sine by taking the imaginary part:

sin(&omega t) = Im[e&omega t]

What else can we do with Z?

The Z Transform!

Given a difference equation of the form:

y(n) = x(n) + a1x(n-1) + a2x(n-2) + ... + aMx(n-M)
                      - b1y(n-1) - b2y(n-2) - ... - bMy(n-M)

The Z transform of this is:

Y(&omega) = X + a1XZ-1 + a2XZ-2 + ... + a MXZ-M
              - b1YZ-1 - b2YZ-2 - ... - bMYZ -M

Some algebra yields the "Transfer Function":

Y/X (&omega) = H(&omega) =

(1 + a1Z-1 + a2Z-2 + ... + aMZ -M)
----------------------------------------------
(1 + b1Z-1 + b2Z-2 + ... + bMZ-M)

If we want to know the magnitude frequency response of
a filter at any frequency, then we just need to plug in for
&omega, collect real terms and imaginary terms, and compute
the squareroot of the sum of the squared real and squared
imaginary terms. The magnitude of a ratio is the ratio of
the magnitudes (| numerator | / | denominator |), so

| H | = Sqrt[ Re(numerator)2 + Im(numerator)2 ] /
                     
Sqrt[ Re(denominator)2 + Im(denominator)2 ]

If we want the phase, we compute Arctan (Im/Re).
The phase angle of a ratio of phasors is the numerator
angle minus the denominator angle:

Arctan (Im(num.) / Re(num.)) - Arctan (Im(denom.) / Re(denom.))

Let's do a specific magnitude example:

y(n) = x(n) + y(n-1)

Y(&omega) = X(&omega) + Y(&omega)Z-1

H(&omega) = Y/X(&omega) = 1 / (1 - cos(&omega) + jsin(&omega))

| H (&omega) | = 1 / sqrt[1-2cos(&omega)+cos2(&omega) + sin2(&o mega)]
= 1 / sqrt(2-2cos(&omega)) = 1 / sqrt(sin2(2&omega)) = 1/sin(2&omega)

YAY!!