Chapter 4: Transfer Functions and Block Diagrams
Lesson 1: From Differential Equations to Transfer Functions
This lesson formalizes how linear time-invariant (LTI) system models written as ordinary differential equations (ODEs) are transformed into algebraic models in the complex variable \( s \), called transfer functions. Using the Laplace transform, we rigorously derive the transfer function of SISO systems under zero initial conditions, relate transfer functions to impulse responses, and illustrate the procedure on mechanical and electromechanical examples relevant to robotics actuators.
1. Conceptual Overview: Why Transfer Functions?
In previous chapters, you modeled physical systems (mechanical, electrical, electromechanical) by linear ODEs with constant coefficients. For a single-input, single-output (SISO) LTI system, we typically write
\[ a_n \frac{d^n y(t)}{dt^n} + a_{n-1} \frac{d^{n-1} y(t)}{dt^{n-1}} + \cdots + a_1 \frac{dy(t)}{dt} + a_0 y(t) = \\ b_m \frac{d^m u(t)}{dt^m} + b_{m-1} \frac{d^{m-1} u(t)}{dt^{m-1}} + \cdots + b_1 \frac{du(t)}{dt} + b_0 u(t), \]
where \( u(t) \) is the input and \( y(t) \) is the output. Working directly in the time domain with derivatives is often cumbersome for analysis and design.
The transfer function is an algebraic object in the complex variable \( s \) that encodes the same linear dynamics, but in a form that is much easier to manipulate, connect in feedback, and later interpret in terms of stability and performance. Under appropriate conditions, we will derive
\[ G(s) \triangleq \frac{Y(s)}{U(s)} = \frac{b_m s^m + b_{m-1} s^{m-1} + \cdots + b_0} {a_n s^n + a_{n-1} s^{n-1} + \cdots + a_0}, \]
where \( U(s) \) and \( Y(s) \) are the Laplace transforms of \( u(t) \) and \( y(t) \). This object \( G(s) \) will be our central tool for the next several chapters.
flowchart TD
A["Physical system (mechanical, electrical, etc.)"] --> B["Modeling: linear ODE with constant coefficients"]
B --> C["Apply Laplace transform (zero initial conditions)"]
C --> D["Algebraic relation: P(s) Y(s) = Q(s) U(s)"]
D --> E["Define transfer function G(s) = Y(s)/U(s)"]
E --> F["Use G(s) for analysis and later controller design"]
2. LTI Differential Equations and Laplace Transform of Derivatives
Recall the (unilateral) Laplace transform of a signal \( x(t) \), assumed to be of exponential order:
\[ X(s) = \mathcal{L}\{x(t)\}(s) = \int_0^{\infty} x(t)e^{-st}\,dt, \quad s \in \mathbb{C},\ \Re(s) \gt \sigma_0. \]
A key property you reviewed in Chapter 2 is the transform of derivatives. For a sufficiently smooth function \( y(t) \),
\[ \mathcal{L}\left\{\frac{d^k y(t)}{dt^k}\right\}(s) = s^k Y(s) - s^{k-1} y(0^-) - s^{k-2} y'(0^-) - \cdots - y^{(k-1)}(0^-), \]
where \( 0^- \) denotes the left limit at the origin. For control analysis, we almost always consider the response starting from a rest state, i.e., all initial conditions are zero:
\[ y(0^-) = y'(0^-) = \cdots = y^{(n-1)}(0^-) = 0. \]
Under this zero initial condition assumption, the derivative property simplifies to
\[ \mathcal{L}\left\{\frac{d^k y(t)}{dt^k}\right\}(s) = s^k Y(s). \]
The transfer function therefore captures the mapping from input to output for the forced response assuming the system starts from rest. Contributions from nonzero initial conditions can be treated separately (still using Laplace transforms), but they are not part of the transfer function.
3. General Derivation: From Differential Equation to Transfer Function
Consider again the general nth-order SISO LTI ODE
\[ a_n \frac{d^n y(t)}{dt^n} + a_{n-1} \frac{d^{n-1} y(t)}{dt^{n-1}} + \cdots + a_1 \frac{dy(t)}{dt} + a_0 y(t) = \\ b_m \frac{d^m u(t)}{dt^m} + b_{m-1} \frac{d^{m-1} u(t)}{dt^{m-1}} + \cdots + b_1 \frac{du(t)}{dt} + b_0 u(t). \]
Apply the Laplace transform to both sides, under zero initial conditions. Using linearity and the derivative property we obtain
\[ a_n s^n Y(s) + a_{n-1} s^{n-1} Y(s) + \cdots + a_1 s Y(s) + a_0 Y(s) = \\ b_m s^m U(s) + b_{m-1} s^{m-1} U(s) + \cdots + b_1 s U(s) + b_0 U(s). \]
Factor out \( Y(s) \) and \( U(s) \):
\[ \underbrace{\left(a_n s^n + a_{n-1} s^{n-1} + \cdots + a_1 s + a_0\right)}_{P(s)} Y(s) = \underbrace{\left(b_m s^m + b_{m-1} s^{m-1} + \cdots + b_1 s + b_0\right)}_{Q(s)} U(s). \]
Assuming \( P(s) \neq 0 \) in the region of interest, we can write
\[ \frac{Y(s)}{U(s)} = \frac{Q(s)}{P(s)}. \]
This motivates the following definition.
Definition (Transfer Function). The transfer function of a causal LTI system is
\[ G(s) \triangleq \frac{Y(s)}{U(s)} \quad \text{under zero initial conditions}, \]
where \( Y(s) \) and \( U(s) \) are the Laplace transforms of the output and input, respectively. For ODE models with constant coefficients, \( G(s) \) is a rational function:
\[ G(s) = \frac{Q(s)}{P(s)} = \frac{b_m s^m + b_{m-1} s^{m-1} + \cdots + b_0} {a_n s^n + a_{n-1} s^{n-1} + \cdots + a_0}, \]
with real coefficients \( a_i, b_j \) determined by the physical parameters (mass, damping, resistance, etc.).
A useful terminology:
- Proper transfer function: \( m \leq n \).
- Strictly proper transfer function: \( m \lt n \).
- The relative degree is \( n - m \).
In most physical systems used for actuation in robotics, the transfer function is strictly proper: outputs cannot instantaneously react to changes in input.
4. Impulse Response, Convolution, and Transfer Function
For a causal LTI system, the impulse response \( g(t) \) is the output when the input is the Dirac delta \( \delta(t) \). A fundamental result (which you have seen in the context of convolution) is:
\[ y(t) = (g * u)(t) = \int_0^t g(t - \lambda)\,u(\lambda)\,d\lambda. \]
Taking the Laplace transform and using the convolution property,
\[ \mathcal{L}\{y(t)\}(s) = \mathcal{L}\{g * u\}(s) = \mathcal{L}\{g\}(s)\,\mathcal{L}\{u\}(s) = G(s) U(s), \]
so the transfer function is simply the Laplace transform of the impulse response:
\[ G(s) = \mathcal{L}\{g(t)\}(s). \]
Conversely, given \( G(s) \), the impulse response can be obtained (at least in principle) via the inverse Laplace transform:
\[ g(t) = \mathcal{L}^{-1}\{G(s)\}(t). \]
This duality between time-domain convolution and frequency-domain multiplication will later be essential when we analyze the time response of systems using only their transfer functions.
5. Worked Examples: From ODE to Transfer Function
5.1 First-Order System (Typical Thermal or Simple RC Circuit)
Consider a first-order system described by
\[ T \frac{dy(t)}{dt} + y(t) = K u(t), \]
where \( T \gt 0 \) is a time constant and \( K \) is a static gain. Taking Laplace transforms with zero initial conditions:
\[ T s Y(s) + Y(s) = K U(s). \]
Factor \( Y(s) \):
\[ (T s + 1) Y(s) = K U(s) \quad \Rightarrow \quad G(s) = \frac{Y(s)}{U(s)} = \frac{K}{T s + 1}. \]
This is a strictly proper transfer function of relative degree 1.
5.2 Mass–Spring–Damper System (Translational Mechanics)
Consider a standard mass–spring–damper system with mass \( m \), damping \( c \), stiffness \( k \), input force \( u(t) \), and output displacement \( y(t) \):
\[ m \frac{d^2 y(t)}{dt^2} + c \frac{dy(t)}{dt} + k y(t) = u(t). \]
Apply the Laplace transform (zero initial conditions):
\[ m s^2 Y(s) + c s Y(s) + k Y(s) = U(s). \]
Factor \( Y(s) \) and solve for the transfer function \( G(s) = Y(s)/U(s) \):
\[ (m s^2 + c s + k) Y(s) = U(s) \quad \Rightarrow \quad G(s) = \frac{1}{m s^2 + c s + k}. \]
The transfer function is strictly proper with relative degree \( 2 \). Later, we will study how the coefficients \( m, c, k \) influence the time response and stability.
5.3 DC Motor (Armature-Controlled, Speed Output)
In robotics, DC motors are widely used as actuators. An armature-controlled DC motor model (after linearization and combining electrical and mechanical dynamics) often leads to a second-order transfer function from input voltage \( u(t) \) to angular velocity \( \omega(t) \):
\[ G(s) = \frac{\Omega(s)}{U(s)} = \frac{K_t}{J L s^2 + (J R + b L) s + (b R + K_e K_t)}, \]
where \( J \) is rotor inertia, \( b \) viscous friction, \( R \) armature resistance, \( L \) inductance, \( K_t \) torque constant, and \( K_e \) back-EMF constant. This transfer function is the starting point for many robot joint control designs.
flowchart TD
P["Physical parameters (m,c,k,J,R,L,...)"] --> ODE["Differential equation in y(t) and u(t)"]
ODE --> LAPLACE["Apply Laplace transform (zero IC)"]
LAPLACE --> ALG["Algebraic relation in Y(s), U(s)"]
ALG --> G["Form transfer function G(s) = Y(s)/U(s)"]
G --> TOOLS["Use G(s) in software tools (Python, C++, Java, MATLAB, Mathematica)"]
6. Computational Implementations: Python, C++, Java, MATLAB/Simulink, Mathematica
We now show how to encode a simple transfer function, for example \( G(s) = \dfrac{K}{T s + 1} \), in common programming environments. Such representations are often used as components in robotic simulation and control stacks.
6.1 Python (with python-control and Robotics Context)
The python-control library is widely used for control
analysis and interfaces well with robotics packages (e.g. for modeling
actuators in simulation). Example:
import control as ctl # python-control library
import numpy as np
K = 2.0 # static gain
T = 0.5 # time constant
# Transfer function G(s) = K / (T s + 1)
num = [K]
den = [T, 1.0]
G = ctl.TransferFunction(num, den)
print("G(s) =", G)
# Example input: unit step response (relevant for servo motion in robotics)
t = np.linspace(0, 5, 500)
t, y = ctl.step_response(G, T=t)
# For robotic applications, this G(s) might approximate a DC motor speed loop
# in a simulation environment (e.g., within a ROS-based testbench).
6.2 C++ (Basic Transfer Function Class, Usable in ROS/robotics Nodes)
In C++ robotics software (e.g. ROS controllers), transfer functions can be implemented using standard containers and complex arithmetic.
#include <iostream>
#include <vector>
#include <complex>
class TransferFunction {
public:
// G(s) = num(s) / den(s)
std::vector<double> num;
std::vector<double> den;
TransferFunction(const std::vector<double>& n,
const std::vector<double>& d)
: num(n), den(d) {}
std::complex<double> eval(const std::complex<double>& s) const {
std::complex<double> N(0.0, 0.0), D(0.0, 0.0);
for (std::size_t i = 0; i < num.size(); ++i) {
int p = static_cast<int>(num.size() - 1 - i);
N += num[i] * std::pow(s, p);
}
for (std::size_t i = 0; i < den.size(); ++i) {
int p = static_cast<int>(den.size() - 1 - i);
D += den[i] * std::pow(s, p);
}
return N / D;
}
};
int main() {
double K = 2.0;
double T = 0.5;
std::vector<double> num{K};
std::vector<double> den{T, 1.0};
TransferFunction G(num, den);
// Evaluate G(j*omega) at omega = 1 rad/s (for analysis)
std::complex<double> s(0.0, 1.0);
std::complex<double> Gjw = G.eval(s);
std::cout << "G(j*1) = " << Gjw << std::endl;
// In a robotics context, this class can be used inside a ROS node
// to approximate continuous dynamics or to design simple controllers.
return 0;
}
6.3 Java (Simple Transfer Function Class, Robotics-Style)
Java is used in some robotics frameworks (e.g. FRC’s WPILib ecosystem). A minimalistic transfer function representation can look like:
public class TransferFunction {
// G(s) = num(s) / den(s)
private double[] num;
private double[] den;
public TransferFunction(double[] num, double[] den) {
this.num = num;
this.den = den;
}
// Evaluate G(s) for complex s = sigma + j*omega
public Complex eval(Complex s) {
Complex N = Complex.ZERO;
Complex D = Complex.ZERO;
for (int i = 0; i < num.length; i++) {
int p = num.length - 1 - i;
N = N.add(s.pow(p).multiply(num[i]));
}
for (int i = 0; i < den.length; i++) {
int p = den.length - 1 - i;
D = D.add(s.pow(p).multiply(den[i]));
}
return N.divide(D);
}
public static void main(String[] args) {
double K = 2.0;
double T = 0.5;
double[] num = {K};
double[] den = {T, 1.0};
TransferFunction G = new TransferFunction(num, den);
Complex s = new Complex(0.0, 1.0); // j*1
Complex Gjw = G.eval(s);
System.out.println("G(j*1) = " + Gjw);
}
}
In robotics-oriented Java libraries (such as those used in mobile robot simulators or education platforms), similar abstractions are used to build higher-level models of drivetrain or arm dynamics.
6.4 MATLAB/Simulink (Control System Toolbox)
MATLAB’s Control System Toolbox and Simulink are heavily used for modeling robotic actuators and plants.
K = 2.0;
T = 0.5;
% Transfer function G(s) = K / (T s + 1)
s = tf('s');
G = K / (T*s + 1)
% Step response (typical for servo systems)
figure;
step(G);
grid on;
title('Step response of first-order system');
% In Simulink, you would:
% 1. Create a new model.
% 2. Insert a Transfer Fcn block and set Numerator: [K], Denominator: [T 1].
% 3. Connect a Step block as input and a Scope block to visualize y(t).
6.5 Wolfram Mathematica
Mathematica has symbolic support for transfer functions via
TransferFunctionModel:
K = 2.0;
T = 0.5;
(* Transfer function G(s) = K / (T s + 1) *)
G = TransferFunctionModel[ K/(T*s + 1), s ]
(* Compute impulse and step responses symbolically or numerically *)
g[t_] = InverseLaplaceTransform[K/(T*s + 1), s, t];
yStep[t_] = InverseLaplaceTransform[ (K/(T*s + 1))*(1/s), s, t];
(* For robotics applications, such symbolic forms can help
derive closed-form expressions for actuator responses. *)
7. Problems and Solutions
Problem 1 (Second-Order System Transfer Function). Consider the ODE \( \displaystyle \frac{d^2 y(t)}{dt^2} + 5 \frac{dy(t)}{dt} + 6 y(t) = 4 u(t) \). Assuming zero initial conditions, derive the transfer function \( G(s) = Y(s)/U(s) \).
Solution. Take the Laplace transform of both sides:
\[ s^2 Y(s) + 5 s Y(s) + 6 Y(s) = 4 U(s). \]
Factor \( Y(s) \):
\[ (s^2 + 5 s + 6) Y(s) = 4 U(s). \]
Thus,
\[ G(s) = \frac{Y(s)}{U(s)} = \frac{4}{s^2 + 5 s + 6}. \]
Problem 2 (General nth-Order ODE). For the general nth-order ODE \( \sum_{k=0}^{n} a_k \dfrac{d^k y(t)}{dt^k} = \sum_{k=0}^{m} b_k \dfrac{d^k u(t)}{dt^k} \) with zero initial conditions, prove that the transfer function is \( G(s) = \dfrac{\sum_{k=0}^{m} b_k s^k}{\sum_{k=0}^{n} a_k s^k} \).
Solution. Taking the Laplace transform and using linearity yields
\[ \sum_{k=0}^{n} a_k s^k Y(s) = \sum_{k=0}^{m} b_k s^k U(s), \]
since each \( \mathcal{L}\{\frac{d^k y}{dt^k}\} = s^k Y(s) \) and similarly for \( u(t) \). Factor \( Y(s) \) and \( U(s) \):
\[ \left( \sum_{k=0}^{n} a_k s^k \right) Y(s) = \left( \sum_{k=0}^{m} b_k s^k \right) U(s). \]
Provided the polynomial \( \sum_{k=0}^{n} a_k s^k \) is not identically zero, we divide both sides by it:
\[ \frac{Y(s)}{U(s)} = \frac{\sum_{k=0}^{m} b_k s^k}{\sum_{k=0}^{n} a_k s^k}. \]
This proves the stated rational form of the transfer function.
Problem 3 (Initial Conditions vs Transfer Function). Consider the first-order system \( T \dfrac{dy(t)}{dt} + y(t) = K u(t) \) with \( y(0^-) = y_0 \neq 0 \). Show that \( G(s) = \dfrac{K}{T s + 1} \) still holds as the ratio \( Y(s)/U(s) \) for the forced component, but that the full \( Y(s) \) contains an additional term due to the initial condition.
Solution. Take the Laplace transform:
\[ T \left( s Y(s) - y_0 \right) + Y(s) = K U(s). \]
Rearranging,
\[ (T s + 1) Y(s) = K U(s) + T y_0. \]
Thus,
\[ Y(s) = \underbrace{\frac{K}{T s + 1} U(s)}_{\text{forced response}} + \underbrace{\frac{T y_0}{T s + 1}}_{\text{response to initial condition}}. \]
The transfer function is defined as the mapping from \( U(s) \) to the forced component, i.e.
\[ G(s) = \frac{Y_{\text{forced}}(s)}{U(s)} = \frac{K}{T s + 1}, \]
independent of the specific initial condition \( y_0 \).
Problem 4 (Mass–Spring–Damper Relative Degree). For the mass–spring–damper system \( m \dfrac{d^2 y}{dt^2} + c \dfrac{dy}{dt} + k y = u(t) \), compute the relative degree of the transfer function \( G(s) = Y(s)/U(s) \) and argue why such a system cannot react instantaneously to step inputs in displacement.
Solution. We have already derived
\[ G(s) = \frac{1}{m s^2 + c s + k}. \]
The numerator polynomial has degree \( m = 0 \), the denominator has degree \( n = 2 \), so the relative degree is \( n - m = 2 \). A relative degree at least one means the system output does not respond to a step input with a discontinuity in \( y(t) \); instead, the output and its first derivative must satisfy the differential equation, forcing a gradual response. Hence, the displacement cannot jump instantaneously.
Problem 5 (Convolution and Transfer Function). Let \( g(t) \) be the impulse response of a causal LTI system, and suppose the output for input \( u(t) \) is \( y(t) = \int_0^t g(t - \lambda) u(\lambda)\,d\lambda \). Prove that \( G(s) = \mathcal{L}\{g(t)\}(s) \) is equal to \( Y(s)/U(s) \) under zero initial conditions.
Solution. Taking the Laplace transform:
\[ Y(s) = \mathcal{L}\left\{ \int_0^t g(t - \lambda) u(\lambda)\,d\lambda \right\}(s) = \mathcal{L}\{g * u\}(s). \]
By the convolution property,
\[ \mathcal{L}\{g * u\}(s) = \mathcal{L}\{g\}(s)\, \mathcal{L}\{u\}(s) = G(s) U(s). \]
Thus, for \( U(s) \neq 0 \) in the region of interest,
\[ \frac{Y(s)}{U(s)} = G(s) = \mathcal{L}\{g(t)\}(s), \]
which shows the equivalence between the transfer function definition via impulse response and via the ODE.
8. Summary
In this lesson, we systematically derived transfer functions from LTI differential equations using the Laplace transform under zero initial conditions. We showed that physical ODE models give rise to rational functions \( G(s) = Y(s)/U(s) \), and that these transfer functions are equivalent to the Laplace transforms of impulse responses. We worked through canonical examples, including first-order systems, mass–spring–damper dynamics, and a DC motor model relevant to robotic actuators. Finally, we illustrated how to encode transfer functions in several computational environments (Python, C++, Java, MATLAB/Simulink, and Mathematica), laying the foundation for later analysis and controller design based on transfer functions.
9. References
- Bode, H. W. (1940). Relations between attenuation and phase in feedback amplifier design. Bell System Technical Journal, 19(3), 421–454.
- Zames, G. (1966). On the input-output stability of time-varying nonlinear feedback systems. IEEE Transactions on Automatic Control, 11(2), 228–238.
- Desoer, C. A., & Kuh, E. S. (1969). Basic Circuit Theory. McGraw–Hill. (Foundational linear systems and transfer-function theory.)
- Zadeh, L. A., & Desoer, C. A. (1963). Linear System Theory. McGraw–Hill. (Classic theoretical treatment of linear systems and transforms.)
- Kalman, R. E. (1960). Contributions to the theory of optimal control. Boletin de la Sociedad Matematica Mexicana, 5(2), 102–119.
- Kailath, T. (1968). An innovations approach to least-squares estimation—Part I: Linear filtering in additive white noise. IEEE Transactions on Automatic Control, 13(6), 646–655.
- Doyle, J. C., Francis, B. A., & Tannenbaum, A. R. (1992). Feedback Control Theory. Macmillan. (Rigorous linear systems and control framework.)
- Åström, K. J. (1970). Introduction to stochastic control theory. Academic Press. (Theoretical development of linear systems in transform domains.)