# linearizing a non linear state space equation

I have this 1-DOF helicopter simulator.

The motor's armature resistance is $$R$$, inductance $$L$$ and motor constant $$K$$ and reaction torque on the motor shaft is $$τ$$. $$T$$ is equal to $$k_1w_2^2$$ and $$\tau$$ is equal to $$k_2w_2^2$$.

$$w_1 = \dot{\varphi}_1$$

$$w_2=\dot{\theta}$$

Τhe differential equation for the current is:

$$\frac{\partial I}{\partial t}=\frac{E - RI - K_1w_2}{L}$$

in which $$E$$ is the input armature voltage and the equation for the torque is

$$\frac{\partial w_2}{\partial t}=\frac{KI - K_2w_2^2}{J}$$

in which $$k_2w_2^2$$ is the load torque and finally for the last equation I used lagrange method to derive equation of motion of mass $$m$$ and $$M$$.

$$T = \frac{1}{2}mb^2\dot{\varphi}^2 + \frac{1}{2}M\alpha^2\dot{\varphi}^2 + \frac{1}{2}Jw_2^2$$

$$U = mgb\sin\varphi - Μg\alpha\sin\varphi$$

which finally gives

$$mb^2\dot{w} + M\alpha^2\dot{w}_1 + bmg\cos\varphi - Mg\alpha\cos\varphi = -Tb = K_1w_2^2b$$

$$\frac{\partial w_1}{\partial t} = \frac{-k_1w_1^2 + Mg\alpha\cos\varphi - mgb\cos\varphi}{M\alpha^2 + mb^2}$$

I wanna know whether everything here is right and how to linearize it around $$\varphi = 0$$ cause when I try to do that $$\dfrac{\partial w_1}{\partial t}$$ becomes a constant which is:

$$\frac{\partial w_1}{\partial t} = \frac{Mg\alpha - mgb}{M\alpha^2 + mb^2}$$

• Please do some formatting, this is too difficult to read. – Solar Mike Apr 25 '20 at 18:49
• I edited like everything in order to be able for anyone to read it. When you post here don't expect an answer no matter what but help everyone else by making your post as clear as possible. For the linearization around $\phi$ you can take Taylor's series for $sinφ$ and $cosφ$ around zero. – Teo Protoulis Apr 25 '20 at 19:14
• ok, youre right but first deriative of cos will be sin which will be zero at 0 and f(0) will be d(w1)/dt=(Mga-mgb)/)Ma^2+mb^2, as you can see its constant and it doesn't depend on any state variable or inputs, is it wrong? – erfan Apr 25 '20 at 19:18
• The linearization of $sinx$ around zero is not $0$. Search taylor series of $cosx$ and $sinx$. And insert mathjax equations at your comments as well. – Teo Protoulis Apr 25 '20 at 19:21
• it's not sinx, it's cosx as i added just now in the post and it's not zero it's a constant which also i added at the end of the post – erfan Apr 25 '20 at 19:43

The Lagrangian for your 1D pitch system is $$\mathcal{L} := T - U$$, which is

$$\mathcal{L} = \frac{1}{2}(mb^2 + Ma^2)\dot{\phi}^2 + \frac{1}{2}J\dot{\theta}^2 + (Ma - mb)g\sin\phi$$

The Euler-Lagrange Equations are

$$\frac{d}{dt}\bigg(\frac{\partial\mathcal{L}}{\partial \dot{q}_k}\bigg) + \frac{\partial\mathcal{L}}{\partial q_k} = Q_k$$ This gives the EOM

$$(mb^2 + Ma^2)\ddot{\phi} + (Ma - mb)g\cos\phi = -Tb = -k_1\dot{\theta}^2b$$ Under a small angle approximation, $$\cos\phi \approx 1$$, so this leaves

$$(mb^2 + Ma^2)\ddot{\phi} + (Ma - mb)g = -k_1b\dot{\theta}^2,$$ or in another form, $$\ddot{\phi} = \frac{mb-Ma}{mb^2 + Ma^2}g - \frac{k_1b}{mb^2 + Ma^2}\dot{\theta}^2 = \beta_1 - \beta_2\dot{\theta}^2.$$ Now, I don't know if these are the correct equations for your system, but based on what you outlined in your question, this is what the EOM are for $$\phi(t)$$.

You also have a coupled system of ODE's for $$I(t)$$ and $$\theta(t)$$ since from $$\dot{\theta} = \omega_2$$ it follows that

\begin{align} \ddot{\theta} &= \frac{K}{J}I - \frac{k_2}{J}\dot{\theta}^2\\ \dot{I} &= \frac{E}{L} - \frac{R}{L}I - \frac{k_1}{L}\dot{\theta} \end{align}

Again, this is all based off your model that you wrote in the problem statement. So, in total, you have three ODE's for the three variables $$\theta,\phi,I$$. Given that this system of 3 ODE's is nonlinear, there is no analytical solution. What you can do to simulate this is solve the system in MATLAB for example using ODE45 or just any differential equaton solver.

If you want to linearize this system, you can do the following. First, put the system in state space form, i.e. let $$x = [\phi,\dot{\phi},\theta,\dot{\theta},I]^\intercal$$ so that the full dynamics are

\begin{align} \dot{x}_1 &= x_2\\ \dot{x}_2 &= \beta_1\cos x_1 - \beta_2 x_4^2\\ \dot{x}_3 &= x_4\\ \dot{x}_4 &= \frac{K}{J}x_5 - \frac{k_2}{J}x_4^2\\ \dot{x}_6 &= \frac{E}{L} - \frac{R}{L}x_5 - \frac{k_1}{L}x_4. \end{align} Notice that the nonlinear equations are the second one and the fourth one. So right now you system like $$\dot{x} = f(x)$$, where $$f(x)$$ is a nonlinear function (5 by 1 vector). To linearize this sytem into the form $$\dot{x} = Ax$$, you can set

$$A = \bigg[\frac{\partial f}{\partial x}\bigg]_0,$$ evaluated at some nominal conditions, which will give a 5 by 5 matrix. In your case this gives

$$A = \begin{bmatrix} 0 & 1 & 0 & 0 & 0\\ -\beta_1\sin x_1 & 0 & 0 & -2\beta_2 x_4 & 0\\ 0 & 0 & 0 & 1 & 0\\ 0 & 0 & 0 & -2\frac{k_2}{J}x_4 & \frac{K}{J}\\ 0 & 0 & 0 & -\frac{k_1}{L} & -\frac{R}{L} \end{bmatrix}_0$$ So you need to come up with some reference point for linearization for $$\phi$$ and $$\dot{\theta}$$, and then you can simulate the linearized system.

• this is exactly what i derived too which is nonlinear, you mean it can't be linearized? especially ϕ¨ – erfan Apr 25 '20 at 20:12
• You should maybe add that for the process you are proposing, you first need to find the system's equilibrium points and then linearize around one of these equilibrium points. These points are not reference points, you can't just pick them randomly. – Teo Protoulis Apr 25 '20 at 20:33
• Not necessarily. Your equilibrium condition will be when the thrust completely balances out gravity so the equilibrium angular velocity of the rotor is NOT zero. – Josh Pilipovsky Apr 25 '20 at 21:44
• When performing the linearization, you don’t necessarily have to do it about $x = 0$. You linearize about nominal conditions. In your problem, your “nominal” is when the beam or whatever is straight and level. This corresponds to a pitch $\phi_0 = 0$. However, when it is level, the motor is still spinning so the thrust is nonzero and as such, there is a nonzero nominal angular velocity, $\dot{\theta}_0 \neq 0$. – Josh Pilipovsky Apr 26 '20 at 5:34
• Well, what I can't find out is how the equilibrium point of the nonlinear state space equations is $0$ since the second state space equation involves $\cos(x_1)$ which is zero for $\frac{pi}{2}$ (and its multipliers). – Teo Protoulis Apr 26 '20 at 14:53