Salta al contenuto
Note per Studenti Linearization of Nonlinear Systems Report

Linearization of Nonlinear Systems

In questa pagina 7

Idea

A nonlinear system x˙=f(x,u)\dot 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)) with x∈Rx \in \mathbb{R}. If x˙(t)=0\dot x(t) = 0 then x(t)=x(t+τ)x(t) = x(t+\tau) for all τ\tau, that is f(x(t))=0f(x(t)) = 0. A point xˉ\bar x is an equilibrium if

f(xˉ)=0.f(\bar x) = 0.

Linearization around xˉ=0\bar x = 0

Assumption: the equilibrium is xˉ=0\bar x = 0 and x≈xˉx \approx \bar x, that is ∣x∣≪1|x| \ll 1. Expand ff in a Taylor series:

x˙(t)=f(x)=f(0)+f′(0) x+f′′(0)2 x2+…  ≃  f′(0) x,\dot x(t) = f(x) = f(0) + f'(0)\,x + \frac{f''(0)}{2}\,x^2 + \dots \;\simeq\; f'(0)\,x,

because f(0)=0f(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).

For x∈Rnx \in \mathbb{R}^n and f=(f1,…,fn)Tf = (f_1, \dots, f_n)^T, the same procedure gives

x˙(t)=(∂f1∂x1(0)⋯∂f1∂xn(0)⋮⋮∂fn∂x1(0)⋯∂fn∂xn(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),

so F=Jf(x)∣x=0F = J_f(x)\big|_{x=0}, the Jacobian matrix of ff with respect to xx evaluated at xˉ=0\bar x = 0. It holds true only while xx remains close to xˉ\bar x.

Case xˉ≠0\bar x \neq 0

Introduce the new state variable z=x−xˉz = x - \bar x. Since xˉ˙=f(xˉ)=0\dot{\bar x} = f(\bar 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),

and zˉ=0\bar z = 0 is an equilibrium of z˙=f~(z)\dot z = \tilde f(z), so everything above applies. In fact, if xˉ≠0\bar x \neq 0, everything works by setting

F≐Jf(x)∣x=xˉ.F \doteq J_f(x)\big|_{x=\bar 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 →: x1=θx_1 = \theta, x2=θ˙x_2 = \dot\theta,

f1(x)=x2,f2(x)=−gLsin⁡x1+1mL(cos⁡x1) u.f_1(x) = x_2, \qquad f_2(x) = -\frac{g}{L}\sin x_1 + \frac{1}{mL}(\cos x_1)\,u.

Equilibrium 1: xˉ=0=(00)\bar x = 0 = \begin{pmatrix} 0 \\ 0 \end{pmatrix}, uˉ=0\bar u = 0. The partial derivatives are

∂f1∂x2=1,∂f2∂x1=−gLcos⁡x1+1mL(−sin⁡x1) 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,

and at the equilibrium ∂f1/∂x2=1\partial f_1/\partial x_2 = 1, ∂f2/∂x1=−g/L\partial f_2/\partial x_1 = -g/L. The linearized model is

x˙1=x2,x˙2=−gLx1⟺x˙(t)=(01−gL0)⏟Fx(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).

A warning on the board: the approximation is quite accurate for ∣θ∣≲17∘|\theta| \lesssim 17^\circ.

Equilibrium 2 (pendulum upside down): θ=π\theta = \pi, θ˙=0\dot\theta = 0, so xˉ=(π0)\bar x = \begin{pmatrix} \pi \\ 0 \end{pmatrix}. 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.

The "new dynamics" with respect to zz (free pendulum) is

z˙1=x2=z2,z˙2=−gLsin⁡(z1+π)⇒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).

Linearize: ∂f~1∂z2(0)=1\dfrac{\partial \tilde f_1}{\partial z_2}(0) = 1 and ∂f~2∂z1(0)=−gLcos⁡(0+π)=−gLcos⁡π=gL\dfrac{\partial \tilde f_2}{\partial z_1}(0) = -\dfrac{g}{L}\cos(0 + \pi) = -\dfrac{g}{L}\cos\pi = \dfrac{g}{L}. The linearized model with zˉ=0\bar z = 0 is

z˙1=z2,z˙2=gLz1,z˙(t)=(01gL0)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).

If the model is wanted with respect to x(t)x(t), using z1=x1−πz_1 = x_1 - \pi, z2=x2z_2 = x_2:

x˙1=x2,x˙2=gLx1−gLπ,x˙(t)=(01gL0)x(t)−(0gLπ).\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}.

The term −gLπ-\frac{g}{L}\pi is a constant input.

Alternative: approximate the terms of ff directly

Instead of computing the Jacobian, the nonlinear terms in f(x)f(x) can be replaced by their first-order approximations. Example:

x˙1=sin⁡(x1+x2)+ex2−1=f1(x),x˙2=cos⁡(x1+x22)−1+x1x22=f2(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).

Via the Jacobian:

Jf(x)=(cos⁡(x1+x2)cos⁡(x1+x2)+ex2−sin⁡(x1+x22)+x22−2x2sin⁡(x1+x22)+2x1x2),Jf(x)∣x=0=(1200),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},

so x˙1=x1+2x2\dot x_1 = x_1 + 2x_2, x˙2=0\dot x_2 = 0. (On the whiteboard entry (2,1)(2,1) has x1+x2x_1 + x_2 inside the sine; the derivative of cos⁡(x1+x22)\cos(x_1 + x_2^2) gives x1+x22x_1 + x_2^2. The value at the origin is the same.)

Directly on the terms: near 00 one has sin⁡(x)=x+o(x)\sin(x) = x + o(x), hence sin⁡(x1+x2)=x1+x2+o(x1+x2)\sin(x_1 + x_2) = x_1 + x_2 + o(x_1 + x_2) near x1=0x_1 = 0, x2=0x_2 = 0; and ex=1+x+o(x)e^{x} = 1 + x + o(x), hence ex2=1+x2+o(x2)e^{x_2} = 1 + x_2 + o(x_2). Then

f1(x)  ≃ x≃xˉ  x1+x2+1+x2−1=x1+2x2,f_1(x) \;\simeq_{\,x \simeq \bar x}\; x_1 + x_2 + 1 + x_2 - 1 = x_1 + 2x_2,

the same result as the Jacobian.

Example: three-tank model

A water distribution network with supply uu and demand Q2Q_2. Drawing: tank 1 (level x1x_1, area A1A_1, inflow u1u_1) is connected through a pipe with flow Q13Q_{13} to tank 3 (level x3x_3, area A3A_3), which is connected through a pipe with flow Q32Q_{32} to tank 2 (level x2x_2, area A2A_2, inflow u2u_2, outflow Q2Q_2).

  • xix_i: water level in tank ii;
  • AiA_i: area of tank ii;
  • aija_{ij}: pipe coefficients;
  • QijQ_{ij}: flow from ii to jj.

x˙1(t)=A1−1(u1(t)−Q13(t))x˙2(t)=A2−1(u2(t)+Q32(t)−Q2(t))x˙3(t)=A3−1(Q13(t)−Q32(t))Qij(t)=aij sign(xi(t)−xj(t))2g ∣xi(t)−xj(t)∣Q2(t)=a22g x2(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}

The terms sign(⋅)\mathrm{sign}(\cdot) and ∣⋅∣\sqrt{|\cdot|} are non-differentiable. However, as we linearize about an equilibrium (xˉ,uˉ)(\bar x, \bar 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: for any equilibrium it holds xˉ1>xˉ3>xˉ2\bar x_1 > \bar x_3 > \bar x_2. So we assume x1(t)>x3(t)>x2(t)x_1(t) > x_3(t) > x_2(t) and, near xˉ\bar x,

Q13(t)=a132g (x1(t)−x3(t)),Q32(t)=a322g (x3(t)−x2(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)}.

Note that in this case the equilibrium (working point) comprises both xˉ\bar x and the constant inputs uˉ\bar u.

Versione ripasso

  • Valid only while the system stays close to the target state.
  • Equilibrium: f(xˉ)=0f(\bar x) = 0. Around xˉ=0\bar x = 0: x˙≃f′(0)x\dot x \simeq f'(0)x; for x∈Rnx \in \mathbb{R}^n, x˙=Fx\dot x = F x with F=Jf(x)∣x=0F = J_f(x)\big|_{x=0} (Jacobian, entries ∂fi/∂xj\partial f_i/\partial x_j).
  • If xˉ≠0\bar x \neq 0: z=x−xˉz = x - \bar x, z˙=f(z+xˉ)=f~(z)\dot z = f(z + \bar x) = \tilde f(z), F=Jf(x)∣x=xˉF = J_f(x)\big|_{x=\bar x}.
  • Pendulum, xˉ=0\bar x = 0: F=(01−gL0)F = \begin{pmatrix} 0 & 1 \\ -\frac{g}{L} & 0 \end{pmatrix} (accurate for ∣θ∣≲17∘|\theta| \lesssim 17^\circ). Upside down, xˉ=(π,0)T\bar x = (\pi, 0)^T: z=x−xˉz = x - \bar x, z˙2=−gLsin⁡(z1+π)\dot z_2 = -\frac{g}{L}\sin(z_1 + \pi), F=(01gL0)F = \begin{pmatrix} 0 & 1 \\ \frac{g}{L} & 0 \end{pmatrix}; in xx there is a constant input −gLπ-\frac{g}{L}\pi.
  • Direct approximation: sin⁡x=x+o(x)\sin x = x + o(x), ex=1+x+o(x)e^x = 1 + x + o(x); example f1≃x1+2x2f_1 \simeq x_1 + 2x_2, Jacobian at 00 is (1200)\begin{pmatrix} 1 & 2 \\ 0 & 0 \end{pmatrix}.
  • Three tanks: x˙1=A1−1(u1−Q13)\dot x_1 = A_1^{-1}(u_1 - Q_{13}), x˙2=A2−1(u2+Q32−Q2)\dot x_2 = A_2^{-1}(u_2 + Q_{32} - Q_2), x˙3=A3−1(Q13−Q32)\dot x_3 = A_3^{-1}(Q_{13} - Q_{32}), Qij=aij sign(xi−xj)2g∣xi−xj∣Q_{ij} = a_{ij}\,\mathrm{sign}(x_i - x_j)\sqrt{2g|x_i - x_j|}, Q2=a22gx2Q_2 = a_2\sqrt{2gx_2}. Non-differentiable, but near equilibrium xˉ1>xˉ3>xˉ2\bar x_1 > \bar x_3 > \bar x_2 removes the sign and the absolute value; the working point includes uˉ\bar u.

Teoria collegata