Complex Exponentials and Phasors
The complex exponential is the hero of this course. It is a point moving around the unit circle at angular speed ; its real part is and its imaginary part . Linear time-invariant systems can only scale and delay such a signal, never change its frequency, which is why every signal is decomposed into them.
A rotating point
Negative frequencies are not mysterious: rotates clockwise. A real cosine is the average of a counter-clockwise and a clockwise rotation, .
import numpy as np
f = 2 # 2 rotations per second
t = np.arange(0, 0.5, 0.0625) # 8 instants over one rotation
z = np.exp(2j * np.pi * f * t)
print("angle (deg):", (np.round(np.degrees(np.angle(z)), 1) + 0.0).tolist())
print("real part: ", (np.round(z.real, 3) + 0.0).tolist())
print("|z|: ", np.round(np.abs(z), 12).tolist())
avg = (np.exp(2j * np.pi * f * t) + np.exp(-2j * np.pi * f * t)) / 2
print("average of +f and -f is real:", np.allclose(avg.imag, 0), np.allclose(avg.real, np.cos(2 * np.pi * f * t)))angle (deg): [0.0, 45.0, 90.0, 135.0, 180.0, -135.0, -90.0, -45.0]
real part: [1.0, 0.707, 0.0, -0.707, -1.0, -0.707, 0.0, 0.707]
|z|: [1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]
average of +f and -f is real: True True
Phasors
A sinusoid is the real part of . The fixed complex number , the phasor, records amplitude and phase; the factor is common to every signal of that frequency. Adding sinusoids of the same frequency becomes adding complex numbers:
import numpy as np
# 3 cos(wt + 0.5) + 4 cos(wt - 1.2): add the phasors
p = 3 * np.exp(0.5j) + 4 * np.exp(-1.2j)
A, phi = abs(p), np.angle(p)
print(f"sum = {A:.4f} cos(wt + ({phi:.4f}))")
w = 2 * np.pi * 5
t = np.linspace(0, 1, 1000)
lhs = 3 * np.cos(w * t + 0.5) + 4 * np.cos(w * t - 1.2)
rhs = A * np.cos(w * t + phi)
print("max difference:", float(np.max(np.abs(lhs - rhs))) < 1e-12)sum = 4.6806 cos(wt + (-0.5112))
max difference: True
Why exponentials are special
Delaying by multiplies it by a constant: . Differentiating multiplies it by . So for any system built from delays, sums and derivatives, the output to is : the same exponential, scaled by a complex number. In linear-algebra terms, complex exponentials are eigenfunctions of every LTI system (Frequency Response).
import numpy as np
w = 3.0
t = np.linspace(0, 2, 2001)
x = np.exp(1j * w * t)
dx = np.gradient(x, t) # numerical derivative
ratio = dx[100:-100] / x[100:-100] # skip the less accurate edges
print("derivative / signal is constant:", np.allclose(ratio, ratio[0], atol=1e-4))
print("that constant is about", complex(round(ratio[0].real, 4) + 0.0, round(ratio[0].imag, 4)), " i*w =", 1j * w)derivative / signal is constant: True
that constant is about 3j i*w = 3j
In software
- AC circuit analysis uses phasors: impedances , , combine like resistors.
- Software radios (SDR) deliver complex "I/Q" samples: the real and imaginary parts of the signal's phasor relative to the tuned frequency.
Exercises
Exercise 1: Phasor of a sine
What is the phasor of ?
Answer
.
Solution
, so and , giving .
Exercise 2: Delay as a phase
A 50 Hz signal is delayed by 5 ms. By how many radians does its phase change?
Answer
(a quarter period).
Solution
The phase factor is with . 5 ms is a quarter of the 20 ms period.
Exercise 3: Adding three phasors (code)
Write as a single sinusoid.
Answer
It is identically 0.
Solution
import numpy as np
p = sum(np.exp(1j * k * 2 * np.pi / 3) for k in range(3))
print(round(abs(p), 12))0.0
The three phasors are the cube roots of unity and cancel. This is why a balanced three-phase power system needs no return current in the neutral wire.
Test yourself
The real part of is…
- 1
Delaying by multiplies it by…
Why are complex exponentials eigenfunctions of LTI systems?
- they are real
- delays and derivatives only multiply them by a constant
- they have finite energy
- they are periodic with period 1