Idea
A nonlinear system x ˙ = f ( x , u ) \dot x = f(x,u) x ˙ = f ( x , u ) (see State-Space ModelsA state-space model describes a system with a state vector, an input and an output; it can be nonlinear, control-affine or linear (LTI or LTV), in continuous or discrete time.State-Space Models → ) can be replaced by an LTI system. The approximation holds only if the system stays "close" to a target or desired state .
Equilibrium
Take an autonomous system x ˙ ( t ) = f ( x ( t ) ) \dot x(t) = f(x(t)) x ˙ ( t ) = f ( x ( t )) with x ∈ R x \in \mathbb{R} x ∈ R . If x ˙ ( t ) = 0 \dot x(t) = 0 x ˙ ( t ) = 0 then x ( t ) = x ( t + τ ) x(t) = x(t+\tau) x ( t ) = x ( t + τ ) for all τ \tau τ , that is f ( x ( t ) ) = 0 f(x(t)) = 0 f ( x ( t )) = 0 . A point x ˉ \bar x x ˉ is an equilibrium if
f ( x ˉ ) = 0. f(\bar x) = 0. f ( x ˉ ) = 0.
Linearization around x ˉ = 0 \bar x = 0 x ˉ = 0
Assumption: the equilibrium is x ˉ = 0 \bar x = 0 x ˉ = 0 and x ≈ x ˉ x \approx \bar x x ≈ x ˉ , that is ∣ x ∣ ≪ 1 |x| \ll 1 ∣ x ∣ ≪ 1 . Expand f f f in a Taylor series:
x ˙ ( t ) = f ( x ) = f ( 0 ) + f ′ ( 0 ) x + f ′ ′ ( 0 ) 2 x 2 + … ≃ f ′ ( 0 ) x , \dot x(t) = f(x) = f(0) + f'(0)\,x + \frac{f''(0)}{2}\,x^2 + \dots \;\simeq\; f'(0)\,x, x ˙ ( t ) = f ( x ) = f ( 0 ) + f ′ ( 0 ) x + 2 f ′′ ( 0 ) x 2 + … ≃ f ′ ( 0 ) x ,
because f ( 0 ) = 0 f(0) = 0 f ( 0 ) = 0 and the higher-order terms are neglected. Hence
x ˙ ( t ) = f ( x ( t ) ) ⟶ x ˙ ( t ) = f ′ ( 0 ) x ( t ) . \dot x(t) = f(x(t)) \quad\longrightarrow\quad \dot x(t) = f'(0)\,x(t). x ˙ ( t ) = f ( x ( t )) ⟶ x ˙ ( t ) = f ′ ( 0 ) x ( t ) .
For x ∈ R n x \in \mathbb{R}^n x ∈ R n and f = ( f 1 , … , f n ) T f = (f_1, \dots, f_n)^T f = ( f 1 , … , f n ) T , the same procedure gives
x ˙ ( t ) = ( ∂ f 1 ∂ x 1 ( 0 ) ⋯ ∂ f 1 ∂ x n ( 0 ) ⋮ ⋮ ∂ f n ∂ x 1 ( 0 ) ⋯ ∂ f n ∂ x n ( 0 ) ) x ( t ) = : F x ( t ) , \dot x(t) = \begin{pmatrix} \dfrac{\partial f_1}{\partial x_1}(0) & \cdots & \dfrac{\partial f_1}{\partial x_n}(0) \\ \vdots & & \vdots \\ \dfrac{\partial f_n}{\partial x_1}(0) & \cdots & \dfrac{\partial f_n}{\partial x_n}(0) \end{pmatrix} x(t) =: F\,x(t), x ˙ ( t ) = ∂ x 1 ∂ f 1 ( 0 ) ⋮ ∂ x 1 ∂ f n ( 0 ) ⋯ ⋯ ∂ x n ∂ f 1 ( 0 ) ⋮ ∂ x n ∂ f n ( 0 ) x ( t ) =: F x ( t ) ,
so F = J f ( x ) ∣ x = 0 F = J_f(x)\big|_{x=0} F = J f ( x ) x = 0 , the Jacobian matrix of f f f with respect to x x x evaluated at x ˉ = 0 \bar x = 0 x ˉ = 0 . It holds true only while x x x remains close to x ˉ \bar x x ˉ .
Case x ˉ ≠ 0 \bar x \neq 0 x ˉ = 0
Introduce the new state variable z = x − x ˉ z = x - \bar x z = x − x ˉ . Since x ˉ ˙ = f ( x ˉ ) = 0 \dot{\bar x} = f(\bar x) = 0 x ˉ ˙ = f ( x ˉ ) = 0 ,
z ˙ = x ˙ − x ˉ ˙ = x ˙ = f ( x ) = f ( z + x ˉ ) = : f ~ ( z ) , \dot z = \dot x - \dot{\bar x} = \dot x = f(x) = f(z + \bar x) =: \tilde f(z), z ˙ = x ˙ − x ˉ ˙ = x ˙ = f ( x ) = f ( z + x ˉ ) =: f ~ ( z ) ,
and z ˉ = 0 \bar z = 0 z ˉ = 0 is an equilibrium of z ˙ = f ~ ( z ) \dot z = \tilde f(z) z ˙ = f ~ ( z ) , so everything above applies. In fact, if x ˉ ≠ 0 \bar x \neq 0 x ˉ = 0 , everything works by setting
F ≐ J f ( x ) ∣ x = x ˉ . F \doteq J_f(x)\big|_{x=\bar x}. F ≐ J f ( x ) x = x ˉ .
Example: pendulum
From Examples of State-Space ModelsWorked state-space models: an RLC circuit, a controlled pendulum, population growth (exponential and logistic, continuous and discrete time), a three-class lab cell population and the Google PageRank iteration.Examples of State-Space Models → : x 1 = θ x_1 = \theta x 1 = θ , x 2 = θ ˙ x_2 = \dot\theta x 2 = θ ˙ ,
f 1 ( x ) = x 2 , f 2 ( x ) = − g L sin x 1 + 1 m L ( cos x 1 ) u . f_1(x) = x_2, \qquad f_2(x) = -\frac{g}{L}\sin x_1 + \frac{1}{mL}(\cos x_1)\,u. f 1 ( x ) = x 2 , f 2 ( x ) = − L g sin x 1 + m L 1 ( cos x 1 ) u .
Equilibrium 1 : x ˉ = 0 = ( 0 0 ) \bar x = 0 = \begin{pmatrix} 0 \\ 0 \end{pmatrix} x ˉ = 0 = ( 0 0 ) , u ˉ = 0 \bar u = 0 u ˉ = 0 . The partial derivatives are
∂ f 1 ∂ x 2 = 1 , ∂ f 2 ∂ x 1 = − g L cos x 1 + 1 m L ( − sin x 1 ) u , \frac{\partial f_1}{\partial x_2} = 1, \qquad \frac{\partial f_2}{\partial x_1} = -\frac{g}{L}\cos x_1 + \frac{1}{mL}(-\sin x_1)\,u, ∂ x 2 ∂ f 1 = 1 , ∂ x 1 ∂ f 2 = − L g cos x 1 + m L 1 ( − sin x 1 ) u ,
and at the equilibrium ∂ f 1 / ∂ x 2 = 1 \partial f_1/\partial x_2 = 1 ∂ f 1 / ∂ x 2 = 1 , ∂ f 2 / ∂ x 1 = − g / L \partial f_2/\partial x_1 = -g/L ∂ f 2 / ∂ x 1 = − g / L . The linearized model is
x ˙ 1 = x 2 , x ˙ 2 = − g L x 1 ⟺ x ˙ ( t ) = ( 0 1 − g L 0 ) ⏟ F x ( t ) . \dot x_1 = x_2, \quad \dot x_2 = -\frac{g}{L}x_1 \qquad\Longleftrightarrow\qquad \dot x(t) = \underbrace{\begin{pmatrix} 0 & 1 \\ -\frac{g}{L} & 0 \end{pmatrix}}_{F} x(t). x ˙ 1 = x 2 , x ˙ 2 = − L g x 1 ⟺ x ˙ ( t ) = F ( 0 − L g 1 0 ) x ( t ) .
A warning on the board: the approximation is quite accurate for ∣ θ ∣ ≲ 1 7 ∘ |\theta| \lesssim 17^\circ ∣ θ ∣ ≲ 1 7 ∘ .
Equilibrium 2 (pendulum upside down): θ = π \theta = \pi θ = π , θ ˙ = 0 \dot\theta = 0 θ ˙ = 0 , so x ˉ = ( π 0 ) \bar x = \begin{pmatrix} \pi \\ 0 \end{pmatrix} x ˉ = ( π 0 ) . Change of variable
z ( t ) = x ( t ) − x ˉ = ( θ ( t ) − π θ ˙ ( t ) ) , z ˉ = 0. z(t) = x(t) - \bar x = \begin{pmatrix} \theta(t) - \pi \\ \dot\theta(t) \end{pmatrix}, \qquad \bar z = 0. z ( t ) = x ( t ) − x ˉ = ( θ ( t ) − π θ ˙ ( t ) ) , z ˉ = 0.
The "new dynamics" with respect to z z z (free pendulum) is
z ˙ 1 = x 2 = z 2 , z ˙ 2 = − g L sin ( z 1 + π ) ⇒ z ˙ = f ~ ( z ) . \dot z_1 = x_2 = z_2, \qquad \dot z_2 = -\frac{g}{L}\sin\big(z_1 + \pi\big) \quad\Rightarrow\quad \dot z = \tilde f(z). z ˙ 1 = x 2 = z 2 , z ˙ 2 = − L g sin ( z 1 + π ) ⇒ z ˙ = f ~ ( z ) .
Linearize: ∂ f ~ 1 ∂ z 2 ( 0 ) = 1 \dfrac{\partial \tilde f_1}{\partial z_2}(0) = 1 ∂ z 2 ∂ f ~ 1 ( 0 ) = 1 and ∂ f ~ 2 ∂ z 1 ( 0 ) = − g L cos ( 0 + π ) = − g L cos π = g L \dfrac{\partial \tilde f_2}{\partial z_1}(0) = -\dfrac{g}{L}\cos(0 + \pi) = -\dfrac{g}{L}\cos\pi = \dfrac{g}{L} ∂ z 1 ∂ f ~ 2 ( 0 ) = − L g cos ( 0 + π ) = − L g cos π = L g . The linearized model with z ˉ = 0 \bar z = 0 z ˉ = 0 is
z ˙ 1 = z 2 , z ˙ 2 = g L z 1 , z ˙ ( t ) = ( 0 1 g L 0 ) z ( t ) . \dot z_1 = z_2, \quad \dot z_2 = \frac{g}{L}z_1, \qquad \dot z(t) = \begin{pmatrix} 0 & 1 \\ \frac{g}{L} & 0 \end{pmatrix} z(t). z ˙ 1 = z 2 , z ˙ 2 = L g z 1 , z ˙ ( t ) = ( 0 L g 1 0 ) z ( t ) .
If the model is wanted with respect to x ( t ) x(t) x ( t ) , using z 1 = x 1 − π z_1 = x_1 - \pi z 1 = x 1 − π , z 2 = x 2 z_2 = x_2 z 2 = x 2 :
x ˙ 1 = x 2 , x ˙ 2 = g L x 1 − g L π , x ˙ ( t ) = ( 0 1 g L 0 ) x ( t ) − ( 0 g L π ) . \dot x_1 = x_2, \qquad \dot x_2 = \frac{g}{L}x_1 - \frac{g}{L}\pi, \qquad \dot x(t) = \begin{pmatrix} 0 & 1 \\ \frac{g}{L} & 0 \end{pmatrix} x(t) - \begin{pmatrix} 0 \\ \frac{g}{L}\pi \end{pmatrix}. x ˙ 1 = x 2 , x ˙ 2 = L g x 1 − L g π , x ˙ ( t ) = ( 0 L g 1 0 ) x ( t ) − ( 0 L g π ) .
The term − g L π -\frac{g}{L}\pi − L g π is a constant input .
Alternative: approximate the terms of f f f directly
Instead of computing the Jacobian, the nonlinear terms in f ( x ) f(x) f ( x ) can be replaced by their first-order approximations. Example:
x ˙ 1 = sin ( x 1 + x 2 ) + e x 2 − 1 = f 1 ( x ) , x ˙ 2 = cos ( x 1 + x 2 2 ) − 1 + x 1 x 2 2 = f 2 ( x ) . \dot x_1 = \sin(x_1 + x_2) + e^{x_2} - 1 = f_1(x), \qquad \dot x_2 = \cos\big(x_1 + x_2^2\big) - 1 + x_1 x_2^2 = f_2(x). x ˙ 1 = sin ( x 1 + x 2 ) + e x 2 − 1 = f 1 ( x ) , x ˙ 2 = cos ( x 1 + x 2 2 ) − 1 + x 1 x 2 2 = f 2 ( x ) .
Via the Jacobian :
J f ( x ) = ( cos ( x 1 + x 2 ) cos ( x 1 + x 2 ) + e x 2 − sin ( x 1 + x 2 2 ) + x 2 2 − 2 x 2 sin ( x 1 + x 2 2 ) + 2 x 1 x 2 ) , J f ( x ) ∣ x = 0 = ( 1 2 0 0 ) , J_f(x) = \begin{pmatrix} \cos(x_1 + x_2) & \cos(x_1 + x_2) + e^{x_2} \\ -\sin\big(x_1 + x_2^2\big) + x_2^2 & -2x_2\sin\big(x_1 + x_2^2\big) + 2x_1x_2 \end{pmatrix}, \qquad J_f(x)\Big|_{x=0} = \begin{pmatrix} 1 & 2 \\ 0 & 0 \end{pmatrix}, J f ( x ) = ( cos ( x 1 + x 2 ) − sin ( x 1 + x 2 2 ) + x 2 2 cos ( x 1 + x 2 ) + e x 2 − 2 x 2 sin ( x 1 + x 2 2 ) + 2 x 1 x 2 ) , J f ( x ) x = 0 = ( 1 0 2 0 ) ,
so x ˙ 1 = x 1 + 2 x 2 \dot x_1 = x_1 + 2x_2 x ˙ 1 = x 1 + 2 x 2 , x ˙ 2 = 0 \dot x_2 = 0 x ˙ 2 = 0 . (On the whiteboard entry ( 2 , 1 ) (2,1) ( 2 , 1 ) has x 1 + x 2 x_1 + x_2 x 1 + x 2 inside the sine; the derivative of cos ( x 1 + x 2 2 ) \cos(x_1 + x_2^2) cos ( x 1 + x 2 2 ) gives x 1 + x 2 2 x_1 + x_2^2 x 1 + x 2 2 . The value at the origin is the same.)
Directly on the terms : near 0 0 0 one has sin ( x ) = x + o ( x ) \sin(x) = x + o(x) sin ( x ) = x + o ( x ) , hence sin ( x 1 + x 2 ) = x 1 + x 2 + o ( x 1 + x 2 ) \sin(x_1 + x_2) = x_1 + x_2 + o(x_1 + x_2) sin ( x 1 + x 2 ) = x 1 + x 2 + o ( x 1 + x 2 ) near x 1 = 0 x_1 = 0 x 1 = 0 , x 2 = 0 x_2 = 0 x 2 = 0 ; and e x = 1 + x + o ( x ) e^{x} = 1 + x + o(x) e x = 1 + x + o ( x ) , hence e x 2 = 1 + x 2 + o ( x 2 ) e^{x_2} = 1 + x_2 + o(x_2) e x 2 = 1 + x 2 + o ( x 2 ) . Then
f 1 ( x ) ≃ x ≃ x ˉ x 1 + x 2 + 1 + x 2 − 1 = x 1 + 2 x 2 , f_1(x) \;\simeq_{\,x \simeq \bar x}\; x_1 + x_2 + 1 + x_2 - 1 = x_1 + 2x_2, f 1 ( x ) ≃ x ≃ x ˉ x 1 + x 2 + 1 + x 2 − 1 = x 1 + 2 x 2 ,
the same result as the Jacobian.
Example: three-tank model
A water distribution network with supply u u u and demand Q 2 Q_2 Q 2 . Drawing: tank 1 (level x 1 x_1 x 1 , area A 1 A_1 A 1 , inflow u 1 u_1 u 1 ) is connected through a pipe with flow Q 13 Q_{13} Q 13 to tank 3 (level x 3 x_3 x 3 , area A 3 A_3 A 3 ), which is connected through a pipe with flow Q 32 Q_{32} Q 32 to tank 2 (level x 2 x_2 x 2 , area A 2 A_2 A 2 , inflow u 2 u_2 u 2 , outflow Q 2 Q_2 Q 2 ).
x i x_i x i : water level in tank i i i ;
A i A_i A i : area of tank i i i ;
a i j a_{ij} a ij : pipe coefficients;
Q i j Q_{ij} Q ij : flow from i i i to j j j .
x ˙ 1 ( t ) = A 1 − 1 ( u 1 ( t ) − Q 13 ( t ) ) x ˙ 2 ( t ) = A 2 − 1 ( u 2 ( t ) + Q 32 ( t ) − Q 2 ( t ) ) x ˙ 3 ( t ) = A 3 − 1 ( Q 13 ( t ) − Q 32 ( t ) ) Q i j ( t ) = a i j s i g n ( x i ( t ) − x j ( t ) ) 2 g ∣ x i ( t ) − x j ( t ) ∣ Q 2 ( t ) = a 2 2 g x 2 ( t ) \begin{aligned} \dot x_1(t) &= A_1^{-1}\big(u_1(t) - Q_{13}(t)\big) \\ \dot x_2(t) &= A_2^{-1}\big(u_2(t) + Q_{32}(t) - Q_2(t)\big) \\ \dot x_3(t) &= A_3^{-1}\big(Q_{13}(t) - Q_{32}(t)\big) \\ Q_{ij}(t) &= a_{ij}\,\mathrm{sign}\big(x_i(t) - x_j(t)\big)\sqrt{2g\,|x_i(t) - x_j(t)|} \\ Q_2(t) &= a_2\sqrt{2g\,x_2(t)} \end{aligned} x ˙ 1 ( t ) x ˙ 2 ( t ) x ˙ 3 ( t ) Q ij ( t ) Q 2 ( t ) = A 1 − 1 ( u 1 ( t ) − Q 13 ( t ) ) = A 2 − 1 ( u 2 ( t ) + Q 32 ( t ) − Q 2 ( t ) ) = A 3 − 1 ( Q 13 ( t ) − Q 32 ( t ) ) = a ij sign ( x i ( t ) − x j ( t ) ) 2 g ∣ x i ( t ) − x j ( t ) ∣ = a 2 2 g x 2 ( t )
The terms s i g n ( ⋅ ) \mathrm{sign}(\cdot) sign ( ⋅ ) and ∣ ⋅ ∣ \sqrt{|\cdot|} ∣ ⋅ ∣ are non-differentiable . However, as we linearize about an equilibrium ( x ˉ , u ˉ ) (\bar x, \bar u) ( x ˉ , u ˉ ) we can "remove" the non-differentiability by considering the order of x ˉ 1 , x ˉ 2 , x ˉ 3 \bar x_1, \bar x_2, \bar x_3 x ˉ 1 , x ˉ 2 , x ˉ 3 : for any equilibrium it holds x ˉ 1 > x ˉ 3 > x ˉ 2 \bar x_1 > \bar x_3 > \bar x_2 x ˉ 1 > x ˉ 3 > x ˉ 2 . So we assume x 1 ( t ) > x 3 ( t ) > x 2 ( t ) x_1(t) > x_3(t) > x_2(t) x 1 ( t ) > x 3 ( t ) > x 2 ( t ) and, near x ˉ \bar x x ˉ ,
Q 13 ( t ) = a 13 2 g ( x 1 ( t ) − x 3 ( t ) ) , Q 32 ( t ) = a 32 2 g ( x 3 ( t ) − x 2 ( t ) ) . Q_{13}(t) = a_{13}\sqrt{2g\,\big(x_1(t) - x_3(t)\big)}, \qquad Q_{32}(t) = a_{32}\sqrt{2g\,\big(x_3(t) - x_2(t)\big)}. Q 13 ( t ) = a 13 2 g ( x 1 ( t ) − x 3 ( t ) ) , Q 32 ( t ) = a 32 2 g ( x 3 ( t ) − x 2 ( t ) ) .
Note that in this case the equilibrium (working point) comprises both x ˉ \bar x x ˉ and the constant inputs u ˉ \bar u u ˉ .