ELECTRONICS - FilterS - guide series
Introduction to Electronics - Filters: Phase shift
Understand how phase shift in RC filters relates to frequency and component values, and how it translates into time delay. Learn how to visualise and control phase behaviour using transfer functions, plots, and practical design choices.
Phase shift is the measure of the time difference between the peaks (or any corresponding points) of an input signal and its filtered output. In first-order filters, such as RC or RL circuits, the output is not only attenuated in amplitude but also shifted in time relative to the input. This shift is expressed as an angle (in degrees or radians) and reflects how the reactive component (capacitor or inductor) delays the signal. For beginners, think of phase shift as the "lag" or "lead" introduced by the filter, which is crucial when signals must be synchronised.
Mathematical Underpinning
For a basic RC low-pass filter, the transfer function is given by:
[math]H(j\omega)=\frac{1}{1+j\omega RC}[/math]
The phase shift, [math]\phi[/math], is the angle of this complex function:
[math]\phi=-\arctan(\omega RC)[/math]
At low frequencies, when [math]\omega RC[/math] is small, [math]\phi[/math] is approximately 0, so the output is nearly in phase with the input. At high frequencies, when [math]\omega RC[/math] is large, [math]\phi[/math] approaches [math]-90^\circ[/math], indicating that the output lags the input by a quarter cycle.
A similar analysis applies to other first-order filters, though the specific phase shift formula may vary depending on the circuit configuration.
Demo Python Script
Below is a Python script that calculates and plots the phase shift for an RC low-pass filter over a range of frequencies. This Visualisation helps you see how the phase shift changes from 0 to [math]-90^\circ[/math] as frequency increases. In this example, we keep the component values (for the resistor and the capacitor) the same, while we change the input frequency.
import numpy as np
import matplotlib.pyplot as plt
# Define resistor and capacitor values
R = 1e3 # Resistance in ohms
C = 1e-6 # Capacitance in farads
# Define frequency range (10 Hz to 1 MHz)
frequencies = np.logspace(1, 6, num=500)
omega = 2 * np.pi * frequencies
# Calculate phase shift in radians for an RC low-pass filter: φ = -arctan(ωRC)
phase_rad = -np.arctan(omega * R * C)
# Convert phase shift to degrees
phase_deg = np.degrees(phase_rad)
# Create the plot
plt.figure(figsize=(8, 4))
plt.semilogx(frequencies,
phase_deg)
plt.xlabel("Frequency (Hz)")
plt.ylabel("Phase Shift (degrees)")
plt.title("Phase Shift of an RC Low-Pass Filter")
plt.grid(True, which="both", linestyle="--")
plt.show()
When you run this script, the plot will show the phase shift (in degrees) as a function of frequency. Notice how at lower frequencies the phase shift is close to [math]0^\circ[/math] and gradually approaches [math]-90^\circ[/math] as the frequency increases.
The phase shift of an RC low-pass filter. Notice the phase shift values for very low and very high frequencies.
Phase Shift in the Time Domain
When I first came across the phase shift concept, I did struggle to understand it. When I first encountered the concept of phase shift, I found it challenging to grasp. However, I discovered that visualising phase shift in the time domain was beneficial. For many individuals new to intermediate electronics, thinking in the time domain is more intuitive than considering the phase. I hope this explanation aids you in understanding phase shift as well. Phase shift can be understood in terms of time delay. For a sinusoidal signal with frequency [math]f[/math], a phase shift of [math]\phi[/math] degrees translates into a time delay of:
[math]\Delta t=\frac{\phi}{360f} \quad \text{seconds}[/math]
… since a full cycle of 360° corresponds to one period [math]T=\frac{1}{f}[/math] seconds. In other words, if one waveform is shifted by a certain phase angle relative to another, this phase difference means that one waveform is delayed (or advanced) in time by [math]\Delta t[/math].
Demo Python Script
The following Python script generates two sine waves at a frequency of 10 Hz. One sine wave has no phase shift, and the other is shifted by [math]-45^\circ[/math], illustrating the corresponding time delay in the time domain.
import numpy as np
import matplotlib.pyplot as plt
# Parameters
f = 10 # Frequency in Hz
phi_deg = -45 # Phase shift in degrees
phi_rad = np.radians(phi_deg) # Convert phase shift to radians
T = 1 / f # Period of the signal
# Calculate time delay corresponding to the phase shift:
# Δt = φ_rad / (2πf)
time_delay = phi_rad / (2 * np.pi * f)
# Generate time vector covering two periods
t = np.linspace(0, 2 * T, 1000)
# Generate sine wave without phase shift
y1 = np.sin(2 * np.pi * f * t)
# Generate sine wave with phase shift
y2 = np.sin(2 * np.pi * f * t + phi_rad)
# Plot both signals
plt.figure(figsize=(8, 4))
plt.plot(t,
y1,
label='Original Signal')
plt.plot(t,
y2,
label=f'Shifted Signal ({phi_deg}°)')
plt.xlabel("Time (s)")
plt.ylabel("Amplitude")
plt.title("Phase Shift in the Time Domain")
plt.legend()
plt.grid(True, linestyle="--")
plt.show()
# Print the time delay corresponding to the phase shift
print(f"A phase shift of {phi_deg}° corresponds to a time delay of "
f"{abs(time_delay):.4f} seconds.")
When you run this script, you will see two sine waves: one without any shift and one delayed by the computed time interval. This Visualisation clearly demonstrates how a phase shift expressed in degrees directly relates to a time delay in the signal.
Same frequency, different phase shift
Even though both signals share the same frequency, the phase shift arises from the reactive component in the circuit (such as a capacitor or an inductor). These components introduce a time delay due to their frequency-dependent impedance, which has an inherent phase angle. For instance, in an RC circuit the capacitor’s impedance is [math]Z_C = \frac{1}{j\omega C}[/math], causing the voltage across it to lag the input signal. This delay is what manifests as a phase shift between the two signals, even though their frequencies remain identical.
Let’s take a closer look at phase shift caused by different capacitor values, at a range of frequencies.
Effect of Capacitor Value on Phase Shift
In an RC low-pass filter, the phase shift is given by
[math]\phi=-\arctan(\omega RC)[/math]
… where [math]R[/math] is the resistance, [math]C[/math] is the capacitance, and [math]\Omega[/math] is the angular frequency. The product [math]RC[/math] is the time constant of the circuit. Changing the value of the capacitor directly alters this time constant, which in turn shifts the phase response. For a fixed resistor, increasing the capacitor value increases [math]RC[/math], causing the phase shift to occur at lower frequencies, whereas decreasing [math]C[/math] shifts the phase response to higher frequencies.
Mathematical Underpinning
As shown above, the phase shift for an RC filter is expressed as
[math]\phi=-\arctan(\omega RC)[/math]
This equation indicates that the phase shift is controlled by the product [math]\omega RC[/math]. When [math]C[/math] is increased, even at a lower frequency the value of [math]\omega RC[/math] becomes significant, and the phase shift approaches [math]-90^\circ[/math] sooner. Conversely, with a smaller capacitor, a higher frequency is required for the same phase shift to occur.
Demo Python Script
The following Python script plots the phase shift for several capacitor values while keeping the resistor value constant. This Visualisation demonstrates how varying the capacitor value changes the phase shift behaviour across the frequency spectrum.
import numpy as np
import matplotlib.pyplot as plt
# Parameters
f = 10 # Frequency in Hz
phi_deg = -45 # Phase shift in degrees
phi_rad = np.radians(phi_deg) # Convert phase shift to radians
T = 1 / f # Period of the signal
# Calculate time delay corresponding to the phase shift:
# Δt = φ_rad / (2πf)
time_delay = phi_rad / (2 * np.pi * f)
# Generate time vector covering two periods
t = np.linspace(0, 2 * T, 1000)
# Generate sine wave without phase shift
y1 = np.sin(2 * np.pi * f * t)
# Generate sine wave with phase shift
y2 = np.sin(2 * np.pi * f * t + phi_rad)
# Plot both signals
plt.figure(figsize=(8, 4))
plt.plot(t,
y1,
label='Original Signal')
plt.plot(t,
y2,
label=f'Shifted Signal ({phi_deg}°)')
plt.xlabel("Time (s)")
plt.ylabel("Amplitude")
plt.title("Phase Shift in the Time Domain")
plt.legend()
plt.grid(True, linestyle="--")
plt.show()
# Print the time delay corresponding to the phase shift
print(f"A phase shift of {phi_deg}° corresponds to a time delay of "
f"{abs(time_delay):.4f} seconds.")
Here is the plot:
The plot generated by this script illustrates that for a fixed resistor value, larger capacitor values result in a higher [math]C[/math], which increases the product [math]RC[/math] and causes the phase shift to transition more quickly. As a result, the phase shift approaches [math]-90^\circ[/math] at lower frequencies. Conversely, smaller capacitor values lead to a lower [math]C[/math], keeping the phase shift closer to [math]0^\circ[/math] until much higher frequencies are reached, delaying the transition to [math]-90^\circ[/math].
This behaviour underscores the importance of the capacitor value in tuning the phase response of an RC filter. By selecting an appropriate capacitor, engineers can design filters with desired timing and phase characteristics to suit specific applications.
Key Takeaways
- Phase shift quantifies the time delay between an input and its corresponding output signal in a filter, expressed as an angle in degrees or radians.
- In an RC low-pass filter, the phase shift is given by [math]\phi=-\arctan(\omega RC)[/math], which shows that as frequency increases, the phase shift transitions from approximately [math]0^\circ[/math] to [math]-90^\circ[/math].
- A phase shift of [math]\phi[/math] degrees corresponds to a time delay of [math]\Delta t=\frac{\phi}{360f}[/math] seconds for a signal with frequency [math]f[/math], linking angular phase differences to actual time delays.
- The values of reactive components, such as capacitors and inductors, directly affect the phase shift. In an RC filter, increasing the capacitor value increases the time constant [math]RC[/math], resulting in an earlier (lower-frequency) onset of significant phase shift.
Ready for the next tutorial in this series? Here's the next one, or choose an alternative from the list of articles in the side bar. There's also lots of interesting article in our Blog. where you can read about off-grid communication technologies, electronics test equipment, course updates, and much more.
INTRODUCTION TO ELECTRONICS FILTERS
This course and eBook introduces the core concepts of RC and RL filters, helping you understand, design, and analyse these essential circuits. You will learn how low-pass and high-pass filters shape signals, calculate key parameters like cutoff frequency and phase shift, and explore practical applications such as audio tone control, noise filtering, sensor signal conditioning, and switch debouncing.
Jump to another article
- Introduction to Filters
- Real-world applications of first- and second-order filters
- The four filters: low-pass, high-pass, band-pass, and band-stop
- Example: Compare a filtered and unfiltered signal
- Dive into first order RC and RL filters
- What is a first-order filter?
- RC low-pass filter behaviour
- RC high-pass filter behaviour
- RL low-pass filter behaviour
- RL high-pass filter behaviour
- Voltage division in AC using reactance
- Cutoff frequency
- Phase shift
- Step response of first-order filters
- Impulse response of first-order filters
- Just in case... definitions
We publish fresh content each week. Read how-to's on Arduino, ESP32, KiCad, Node-RED, drones and more. Listen to interviews. Learn about new tech with our comprehensive reviews. Get discount offers for our courses and books. Interact with our community. One email per week, no spam; unsubscribe at any time