Chapter 14: Bode Plot Construction and Interpretation
Lesson 1: Logarithmic Scales and Decibels
This lesson introduces logarithmic scales and decibel (dB) measures as the foundational language of frequency-domain analysis in linear control. We move from algebraic properties of logarithms to rigorous definitions of decibels for power, amplitude, and transfer-function magnitudes. We also connect these concepts to control-oriented computations and robotics applications (e.g., servo drives and robot joints), preparing for systematic Bode plot construction in subsequent lessons.
1. Why Logarithmic Scales in Control Engineering?
In linear control, especially for servo and robotic systems, we often analyze frequency response of transfer functions \( G(j\omega) \) over several decades of frequency (e.g., from \( 0.1 \) rad/s to \( 10^4 \) rad/s) and several orders of magnitude in gain. Plotting these quantities on linear axes is impractical:
- Low-frequency behavior is compressed into a tiny interval.
- High-frequency behavior may dominate the plot visually.
- Multiplicative effects of cascaded components (e.g., motor, gear, and sensor in a robot joint) are hard to interpret.
Logarithmic scales solve these issues. For a positive frequency \( \omega > 0 \), we define the base-10 logarithmic coordinate
\[ x = \log_{10} \omega. \]
Equal spacing in \( x \) corresponds to multiplicative spacing in \( \omega \). Thus, each unit increment in \( x \) corresponds to a factor of ten in frequency, called a decade. In control engineering, we typically:
- Plot frequency on a log scale (in decades).
- Plot magnitude of \( G(j\omega) \) in decibels.
- Plot phase in degrees (to be discussed later in the chapter).
The key is that a multiplicative change in gain becomes additive in decibels, mirroring the additive structure of logarithms and greatly simplifying reasoning about cascaded systems.
flowchart TD
A["Physical system: motor + gearbox + sensor"] --> B["Mathematical model: transfer function G(jw)"]
B --> C["Compute magnitude |G(jw)| over wide frequency range"]
C --> D["Use log scale for w (decades)"]
D --> E["Convert magnitude to dB: 20*log10(|G(jw)|)"]
E --> F["Plot: magnitude (dB) vs log10(w)"]
F --> G["Interpret slopes and levels for design"]
2. Mathematical Foundations of Logarithmic Scales
Recall the basic properties of logarithms for \( x,y > 0 \) and base \( b > 0, b \neq 1 \):
\[ \log_b(xy) = \log_b x + \log_b y,\quad \log_b\left(\frac{x}{y}\right) = \log_b x - \log_b y,\quad \log_b(x^k) = k \log_b x. \]
Any base can be expressed via natural logarithms \( \ln(\cdot) \) using the change-of-base formula:
\[ \log_b x = \frac{\ln x}{\ln b},\quad x > 0. \]
In control engineering, base-10 logarithms are most common (for decades of frequency and dB). We thus frequently use:
\[ \log_{10} x = \frac{\ln x}{\ln 10}. \]
Consider three frequencies in a robotic joint actuator model: \( \omega_1 = 10 \), \( \omega_2 = 100 \), and \( \omega_3 = 1000 \) rad/s. Their log coordinates are:
\[ \log_{10}\omega_1 = 1,\quad \log_{10}\omega_2 = 2,\quad \log_{10}\omega_3 = 3. \]
Although the raw frequencies differ by factors of 10, on the log axis they are equally spaced. This property underlies the convenient visual interpretation of Bode magnitude plots: straight lines on a log-log scale correspond to power laws of the form \( C\omega^{k} \).
For example, for \( k=-1 \), \( |G(j\omega)| = \omega^{-1} \), we have:
\[ 20 \log_{10}|G(j\omega)| = 20 \log_{10}(\omega^{-1}) = 20(-1)\log_{10}\omega = -20\log_{10}\omega, \]
which is a straight line with slope \( -20 \) dB per decade. We will systematically exploit such line segments for Bode plots later in the chapter.
3. Definition of Decibels for Power and Amplitude
The decibel (dB) is a logarithmic unit originally used to compare power levels in telecommunication. For power quantities \( P_1,P_2 > 0 \), the power ratio in decibels is defined as:
\[ L_P = 10\log_{10}\left(\frac{P_2}{P_1}\right)\, \text{dB}. \]
In control and robotics, we more often deal with amplitudes: voltages, currents, velocities, or position errors. Suppose power is proportional to the square of some amplitude \( A \), i.e. \( P \propto A^2 \). Then:
\[ \frac{P_2}{P_1} = \left(\frac{A_2}{A_1}\right)^2. \]
Substituting into the power definition of decibels gives:
\[ L_P = 10\log_{10}\left(\frac{P_2}{P_1}\right) = 10\log_{10}\left[\left(\frac{A_2}{A_1}\right)^2\right] = 20\log_{10}\left(\frac{A_2}{A_1}\right). \]
Hence, for amplitude ratios, the standard definition is:
\[ L_A = 20\log_{10}\left(\frac{A_2}{A_1}\right)\,\text{dB}. \]
For a transfer function \( G(j\omega) \) relating input amplitude to output amplitude, we set \( A_2/A_1 = |G(j\omega)| \) and define the magnitude in decibels as:
\[ M_{\text{dB}}(\omega) = 20\log_{10}|G(j\omega)|\;\; \text{(dB)}. \]
Some important reference values (amplitude ratios):
- \( |G(j\omega)| = 1 \) → \( 0 \) dB (no change in amplitude).
- \( |G(j\omega)| = 10 \) → \( 20 \) dB.
- \( |G(j\omega)| = 0.1 \) → \( -20 \) dB.
- \( |G(j\omega)| = 2 \) → approximately \( 6.02 \) dB.
- \( |G(j\omega)| = \sqrt{2} \) → approximately \( 3.01 \) dB.
These numerical values are ubiquitous in controller design and robotics, for example when specifying sensor dynamic range (in dB) or defining bandwidth and resonant peaks of servo loops.
4. Additivity of Decibels and Cascaded Control Components
A major advantage of using dB is that multiplicative gain becomes additive. Consider a cascade of \( n \) LTI components:
\[ G(j\omega) = G_1(j\omega)G_2(j\omega)\cdots G_n(j\omega). \]
Then by the multiplicative property of magnitudes:
\[ |G(j\omega)| = |G_1(j\omega)|\,|G_2(j\omega)|\cdots |G_n(j\omega)|. \]
Taking logarithms and using log rules:
\[ \begin{aligned} M_{\text{dB}}(\omega) &= 20\log_{10}|G(j\omega)| \\ &= 20\log_{10}\left(\prod_{k=1}^n|G_k(j\omega)|\right) \\ &= 20\sum_{k=1}^n \log_{10}|G_k(j\omega)| \\ &= \sum_{k=1}^n 20\log_{10}|G_k(j\omega)| \\ &= \sum_{k=1}^n M_{\text{dB},k}(\omega). \end{aligned} \]
Thus, the total magnitude in dB is the sum of the individual magnitudes in dB. In a robotic joint controller, for instance, we may have:
- Power amplifier,
- DC motor and gearbox,
- Sensor (encoder),
- Digital controller (e.g., a PID).
Each block has its own transfer function and corresponding magnitude in dB. Summing them provides the overall loop magnitude distribution over frequency, which is essential to understand stability margins and performance (to be treated later).
5. Dynamic Range and Logarithmic Frequency Axis
Many control systems (sensory systems, actuators, measurement chains) operate over a very large dynamic range of amplitudes. For example, a high-resolution encoder in a robot arm may need to measure position from micrometers up to several radians of motion; currents in motors may vary from milliamps to tens of amps. Let \( A_{\max} \) and \( A_{\min} \) denote the maximum and minimum measurable amplitudes. The dynamic range in dB is:
\[ \text{DR}_{\text{dB}} = 20\log_{10}\left(\frac{A_{\max}}{A_{\min}}\right). \]
If \( A_{\max}/A_{\min} = 10^6 \), then
\[ \text{DR}_{\text{dB}} = 20\log_{10}(10^6) = 20\cdot 6 = 120\;\text{dB}. \]
A 120 dB dynamic range is typical for high-performance motion-control systems. The log axis for frequency complements this by allowing us to inspect low-, mid-, and high-frequency behavior on a single plot.
flowchart TD
F1["Frequencies: w in [0.1, 10^4] rad/s"] --> L1["Map to log axis: x = log10(w)"]
L1 --> S1["Equal spacing in x = decades of w"]
S1 --> G1["Magnitudes |G(jw)| covering factors of 10^k"]
G1 --> D1["Convert to dB: M_dB = 20*log10(|G(jw)|)"]
D1 --> V1["Single plot: M_dB vs log10(w) shows full dynamic range"]
6. Python Lab — Computing Decibels for a Servo Plant
Consider a simplified first-order model of a robotic joint actuator:
\[ G(s) = \frac{K}{\tau s + 1}, \]
where \( K \) is the steady-state gain and \( \tau > 0 \) is the time constant. The frequency response is:
\[ G(j\omega) = \frac{K}{1 + j\omega\tau}. \]
Below, we compute \( |G(j\omega)| \) and its dB value
over a logarithmically spaced set of frequencies using Python. In
robotics applications, such code might be integrated with
roboticstoolbox for Python to analyze joint frequency
responses derived from more detailed rigid-body models.
import numpy as np
import matplotlib.pyplot as plt
# First-order servo model parameters (e.g., simplified robot joint)
K = 10.0 # dimensionless gain
tau = 0.05 # time constant [s]
def magnitude_db_first_order(K, tau, w):
"""
Compute |G(jw)| in dB for G(s) = K / (tau*s + 1)
where w is a numpy array of frequencies [rad/s].
"""
jw_tau = 1j * w * tau
G_jw = K / (1.0 + jw_tau)
mag = np.abs(G_jw)
return 20.0 * np.log10(mag)
# Logarithmically spaced frequencies (0.1 to 1000 rad/s)
w = np.logspace(-1, 3, 500)
mag_db = magnitude_db_first_order(K, tau, w)
# Plot magnitude in dB vs log10(w)
plt.figure()
plt.semilogx(w, mag_db) # log scale on frequency axis
plt.xlabel("Frequency w [rad/s]")
plt.ylabel("Magnitude [dB]")
plt.title("First-order servo magnitude response (robot joint)")
plt.grid(True, which="both")
plt.show()
In a more complete robotics workflow, you might derive
\( G(s) \) using a robotics modeling library (e.g.,
roboticstoolbox for Python) and then apply the same
conversion to decibels for loop-shaping design.
7. C++ Implementation — Decibel Utilities with Robotics Context
C++ is widely used in real-time control and robotics (e.g., ROS and
ros_control). Below is a small C++ snippet computing dB
values for magnitudes. In practice, these utilities can be used inside a
diagnostic node to inspect frequency responses of joint controllers or
filters.
#include <iostream>
#include <vector>
#include <complex>
#include <cmath>
// Convert amplitude ratio to dB
double ampToDb(double amp) {
return 20.0 * std::log10(amp);
}
// First-order magnitude |G(jw)| for G(s) = K / (tau*s + 1)
double firstOrderMag(double K, double tau, double w) {
std::complex<double> jw(0.0, w);
std::complex<double> G = K / (1.0 + tau * jw);
return std::abs(G);
}
int main() {
double K = 10.0; // servo gain
double tau = 0.05; // time constant
std::vector<double> w_values = {0.1, 1.0, 10.0, 100.0};
for (double w : w_values) {
double mag = firstOrderMag(K, tau, w);
double db = ampToDb(mag);
std::cout << "w = " << w
<< " rad/s, |G(jw)| = " << mag
<< ", magnitude = " << db << " dB\n";
}
return 0;
}
In a ROS-based robotics stack, such code can be combined with existing
joint-level models (often represented with C++ libraries like
Eigen for linear algebra) to assess how modifications in
controller gains change frequency-domain characteristics, always
interpreted through dB scales.
8. Java Implementation — Decibels in Embedded/Robot Software
Java is used in some robotics platforms (for example, educational robot
systems and FIRST Robotics via WPILib). The following Java
code illustrates simple dB utilities that could be used in diagnostics
or offline analysis.
public class DecibelUtils {
// Convert amplitude ratio to dB
public static double ampToDb(double amp) {
return 20.0 * Math.log10(amp);
}
// Magnitude of first-order plant G(s) = K / (tau*s + 1) at frequency w
public static double firstOrderMag(double K, double tau, double w) {
// jw = j*w, so |1 + tau*jw| = sqrt(1 + (tau*w)^2)
double denomMag = Math.sqrt(1.0 + Math.pow(tau * w, 2));
return K / denomMag;
}
public static void main(String[] args) {
double K = 10.0;
double tau = 0.05;
double[] wValues = {0.1, 1.0, 10.0, 100.0};
for (double w : wValues) {
double mag = firstOrderMag(K, tau, w);
double db = ampToDb(mag);
System.out.printf("w = %.2f rad/s, |G(jw)| = %.4f, M_dB = %.2f dB%n",
w, mag, db);
}
}
}
In a robot control framework, the same ampToDb function
could be applied to measured frequency-domain data (obtained by exciting
actuators with sinusoidal inputs) to generate dB-valued frequency
response tables for further analysis.
9. MATLAB/Simulink Implementation — Bode-Type Visualizations
MATLAB and Simulink are standard tools in control and robotics. Using the Control System Toolbox (and optionally Robotics System Toolbox), we can easily generate magnitude plots in dB. Below is a basic MATLAB script:
% First-order servo model: G(s) = K / (tau*s + 1)
K = 10;
tau = 0.05;
s = tf('s');
G = K / (tau*s + 1);
% Frequency range [0.1, 1000] rad/s
w = logspace(-1, 3, 500);
% Compute frequency response
[mag, phase, wout] = bode(G, w);
mag = squeeze(mag);
% Convert magnitude to dB
mag_dB = 20*log10(mag);
figure;
semilogx(wout, mag_dB, 'LineWidth', 1.5);
grid on;
xlabel('Frequency \omega [rad/s]');
ylabel('Magnitude [dB]');
title('First-order servo magnitude response in dB');
% In robotics, G could be obtained from a robot joint model,
% e.g., using Robotics System Toolbox to derive linearized dynamics.
In Simulink, you would typically:
- Build a block diagram with transfer-function blocks representing the actuator and controller.
- Use a frequency response estimation tool or linear analysis points to obtain \( G(j\omega) \).
- Visualize the magnitude in dB using built-in Bode plot tools.
10. Wolfram Mathematica Implementation — Symbolic and Numeric dB
Wolfram Mathematica allows both symbolic manipulation and numeric evaluation of magnitude in dB. The following example defines a first-order transfer function and computes its magnitude in dB:
(* Parameters *)
K = 10.0;
tau = 0.05;
(* Transfer function G(j w) = K / (1 + j tau w) *)
G[w_] := K/(1 + I*tau*w);
(* Magnitude in dB *)
mag[w_] := Abs[G[w]];
magdB[w_] := 20*Log[10, mag[w]];
(* Plot magnitude in dB over [0.1, 1000] rad/s *)
Plot[magdB[w], {w, 0.1, 1000},
ScalingFunctions -> {"Log10", None},
AxesLabel -> {"w [rad/s]", "Magnitude [dB]"},
PlotRange -> All,
GridLines -> Automatic,
PlotLabel -> "First-order servo magnitude in dB"];
Mathematica's symbolic capabilities can later be used to derive asymptotic line approximations to magnitude in dB for more complex transfer functions, reinforcing the theoretical aspects of Bode plot construction.
11. Problems and Solutions
Problem 1 (Amplitude Ratio to dB): A sensor output in a robot joint controller is amplified by a factor of \( 5 \). What is the gain in decibels? Conversely, what amplitude ratio corresponds to a gain of \( 40 \) dB?
Solution:
For amplitude ratio \( A_2/A_1 = 5 \), the gain in dB is:
\[ L_A = 20\log_{10}(5) \approx 20 \times 0.6990 \approx 13.98\;\text{dB}. \]
Thus, a gain of 5 corresponds to approximately \( 14 \) dB. For the second part, let the amplitude ratio be \( r \) and set:
\[ 40 = 20\log_{10}(r) \quad \Rightarrow \quad \log_{10}(r) = 2 \quad \Rightarrow \quad r = 10^2 = 100. \]
So, a 40 dB gain corresponds to an amplitude ratio of \( 100 \).
Problem 2 (Deriving 20 Instead of 10): Starting from the definition of decibels for power, \( L_P = 10\log_{10}(P_2/P_1) \), prove that if power is proportional to amplitude squared, \( P \propto A^2 \), then amplitude ratios lead to the factor 20 in the dB expression.
Solution:
Let \( P = cA^2 \) for some constant \( c > 0 \). Then:
\[ \frac{P_2}{P_1} = \frac{cA_2^2}{cA_1^2} = \left(\frac{A_2}{A_1}\right)^2. \]
Substitute into the definition of power in dB:
\[ \begin{aligned} L_P &= 10\log_{10}\left(\frac{P_2}{P_1}\right) = 10\log_{10}\left[\left(\frac{A_2}{A_1}\right)^2\right] \\ &= 10\cdot 2 \log_{10}\left(\frac{A_2}{A_1}\right) = 20\log_{10}\left(\frac{A_2}{A_1}\right). \end{aligned} \]
Hence amplitude ratios naturally lead to a factor of \( 20 \) rather than \( 10 \) in the decibel definition.
Problem 3 (Additivity of dB in Cascaded Systems): Consider a cascade of two blocks with constant gains \( K_1 = 5 \) and \( K_2 = 0.2 \). Compute the total gain in dB using:
- A direct computation of the product gain.
- The sum of the gains in dB for each block separately.
Solution:
Direct method. The overall gain is:
\[ K = K_1 K_2 = 5 \times 0.2 = 1. \]
Hence, the overall gain in dB is:
\[ L_K = 20\log_{10}(1) = 0\;\text{dB}. \]
Separate dB method. For each block:
\[ L_{K_1} = 20\log_{10}(5) \approx 13.98\;\text{dB},\quad L_{K_2} = 20\log_{10}(0.2) = 20\log_{10}(1/5) \approx -13.98\;\text{dB}. \]
Summing these:
\[ L_K = L_{K_1} + L_{K_2} \approx 13.98 - 13.98 = 0\;\text{dB}, \]
which matches the direct computation. Hence, the additive property of dB correctly reflects multiplicative gains.
Problem 4 (Slope of a First-Order System in dB): For the first-order plant \( G(s) = 1/(\tau s + 1) \) with \( \tau > 0 \), show that at frequencies \( \omega \gg 1/\tau \), the magnitude in dB behaves like a line with slope \( -20 \) dB/decade with respect to \( \omega \).
Solution:
The frequency response magnitude is:
\[ |G(j\omega)| = \frac{1}{\sqrt{1 + (\omega\tau)^2}}. \]
For \( \omega\tau \gg 1 \), we approximate:
\[ |G(j\omega)| \approx \frac{1}{\omega\tau}. \]
Therefore, the magnitude in dB is:
\[ \begin{aligned} M_{\text{dB}}(\omega) &\approx 20\log_{10}\left(\frac{1}{\omega\tau}\right) = 20\left[-\log_{10}(\omega\tau)\right] \\ &= -20\log_{10}\omega - 20\log_{10}\tau. \end{aligned} \]
The term \( -20\log_{10}\tau \) is constant with respect to frequency, while \( -20\log_{10}\omega \) is linear in \( \log_{10}\omega \) with slope \( -20 \) dB per decade. Hence the asymptotic Bode magnitude line falls at \( -20 \) dB for each tenfold increase in frequency.
Problem 5 (Dynamic Range of a Sensor): A position sensor in a robotic arm can reliably measure signals from \( 0.01 \) units to \( 50 \) units of displacement (same units). Compute the dynamic range in dB. If an improved sensor has a dynamic range of \( 120 \) dB but the minimum measurable amplitude is still \( 0.01 \) units, what is its maximum measurable amplitude?
Solution:
For the first sensor:
\[ \text{DR}_{\text{dB}} = 20\log_{10}\left(\frac{A_{\max}}{A_{\min}}\right) = 20\log_{10}\left(\frac{50}{0.01}\right) = 20\log_{10}(5000). \]
Now, \( 5000 = 5 \times 10^3 \), so:
\[ \log_{10}(5000) = \log_{10}(5) + \log_{10}(10^3) \approx 0.6990 + 3 = 3.6990. \]
Thus:
\[ \text{DR}_{\text{dB}} \approx 20 \times 3.6990 \approx 73.98\;\text{dB}. \]
For the improved sensor, let its maximum measurable amplitude be \( A_{\max}^{\text{new}} \). We have:
\[ 120 = 20\log_{10}\left(\frac{A_{\max}^{\text{new}}}{0.01}\right) \quad \Rightarrow \quad \log_{10}\left(\frac{A_{\max}^{\text{new}}}{0.01}\right) = 6. \]
Therefore:
\[ \frac{A_{\max}^{\text{new}}}{0.01} = 10^6 \quad \Rightarrow \quad A_{\max}^{\text{new}} = 0.01 \times 10^6 = 10^4 = 10000. \]
The improved sensor can measure up to \( 10000 \) units of displacement while maintaining the same minimum level, thus achieving a 120 dB dynamic range.
12. Summary
In this lesson, we established the mathematical and engineering foundations of logarithmic scales and decibels. Starting from basic properties of logarithms, we justified the use of base-10 log scales for frequency and defined decibels rigorously for both power and amplitude ratios. We showed how multiplicative gains in cascaded systems become additive in dB, and how dynamic range and asymptotic slopes can be interpreted directly on log-log plots. Finally, we implemented decibel computations in Python, C++, Java, MATLAB/Simulink, and Wolfram Mathematica, with an eye toward integration into robotics workflows. These concepts are the essential language for the construction and interpretation of Bode plots in the remainder of Chapter 14.
13. References
- Bode, H.W. (1945). Network Analysis and Feedback Amplifier Design. Van Nostrand.
- Black, H.S. (1934). Stabilized feedback amplifiers. Bell System Technical Journal, 13(1), 1–18.
- Nyquist, H. (1932). Regeneration theory. Bell System Technical Journal, 11(1), 126–147.
- Zames, G. (1981). Feedback and optimal sensitivity: Model reference transformations, multiplicative seminorms, and approximate inverses. IEEE Transactions on Automatic Control, 26(2), 301–320.
- Freudenberg, J.S., & Looze, D.P. (1985). Right half plane poles and zeros and design tradeoffs in feedback systems. IEEE Transactions on Automatic Control, 30(6), 555–565.
- Maciejowski, J.M. (1989). Multivariable Feedback Design. Addison–Wesley. (Foundational discussion of frequency-domain reasoning and scaling.)
- Åström, K.J., & Murray, R.M. (2010). Feedback Systems: An Introduction for Scientists and Engineers. Princeton University Press. (Chapters on frequency response and Bode plots; theoretical orientation.)
- Kuo, B.C. (1963). Automatic Control Systems. Prentice-Hall. (Early rigorous treatment of logarithmic plots and decibel measures.)
- Truxal, J.G. (1955). Automatic Feedback Control System Synthesis. McGraw-Hill. (Classical synthesis using Bode plots and logarithmic measures.)
- Oppenheim, A.V., & Willsky, A.S. (1997). Signals and Systems. Prentice-Hall. (Formal discussion of frequency response and log-magnitude plots.)