When analyzing linear time-invariant systems (LTI systems) it is often easier to analyze it on the frequency domain. What does this mean? Suppose we apply a sine wave signal into an LTI system, we would get as output another sine wave with the same frequency but with a different amplitude and a different phase angle. Why is this important? In 1807 Joseph Fourier introduced the Fourier series showing that you could write any periodic function as a sum of sine waves with different frequencies, this idea was later extended to non-periodic signals too by the fourier transform so understanding how a system alters the frequency components of a signal can help us understand how the output of a system will relate to it's input.
Suppose we have a system that for a sinusoidal input of angular frequency that has an amplitude of and a phase angle of , the output of our signal will be a sinusoidal wave with frequency , an amplitude of and a phase angle of as seen on the picture.
We define the magnitude of the frequency response as:
And we define the phase angle of the frequency response as:
With that we can define the frequency response to be the phasor:
Those definitions are very helpful for us because it helps us interpret the system as a multiplication by a complex number.
Suppose we have a system with a transfer function of , to calculate the frequency response to this system one may simply evaluate:
Consider a system with transfer function and a signal and let . By calculating we get that:
We can now work out the partial fractions decomposition by the limit method where:
Where and .
By applying the inverse Laplace transform we have that:
Which could as well be written as the phasor multiplication:
Since is the phasor representation of it follows that a system with transfer function has a frequency response .
What is the frequency response of the following RC circuit?
We start by applying Kirchhoff's voltage law, which follows that:
By applying the Laplace transform:
The current on the capacitor can also be described as:
So, the transfer function of this system is:
So the frequency response is given by:
We can also write it as the phasor:
The Bode plot is a tool that helps us visualize how the system will behave in various frequencies, as well as check for the stability. It is particularly nice because, if it's not possible to model the system, one can still find if a system is stable simply by applying various frequencies at it, measuring the gain and plotting the Bode plot.
The Bode plot is actually composed of two plots, the first being the gain and the second being the phase angle for the frequencies. For the gain, we plot on the y-axis the gain in decibels and on the x-axis, the , with being the angular frequency in . On the phase plot, we plot the phase angle in degrees by the angular frequency .
We define the gain in decibels to be:
with being the magnitude of the frequency response at the frequency .
Let's plot the Bode plot for the system with the transfer function:
Details about how to plot it manually will be shown further ahead, this example will only illustrate the bode plot of the system. We can trace it using python with the following code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
from scipy import signal import matplotlib.pyplot as plt import numpy as np # Frequencies to calculate response w = np.linspace(1e-2, 1e2, 1000) # Transfer function of the system sys = signal.TransferFunction([10, 0], [1, 2, 1]) # Calculate the bode plot of the system with the frequncies w, mag, phase = signal.bode(sys, w=w) # Plot the gain plt.subplot(2, 1, 1) plt.grid() plt.title("Bode plot") plt.ylabel("Gain [db]") plt.xlabel("Frequncy [rad/s]") plt.semilogx(w, mag) # Plot the angle plt.subplot(2, 1, 2) plt.grid() plt.ylabel("Phase [deg]") plt.xlabel("Frequncy [rad/s]") plt.semilogx(w, phase) # Ajust graph and show it plt.tight_layout() plt.show()
- Krishnavedala, O. Butterworth response. Retrieved from https://en.wikipedia.org/wiki/Frequency_response