In lecture, we saw the dynamical equations with a quadrotor written as matrix equations, which we call state-space form. In this segment, we'll demonstrate how to transform the ordinary differential equations representing a dynamical system into state-space form. Recall that a dynamical system is a system where the effects of actions do not immediately affect the system. We saw that the evolution of the states of these systems is governed by a set of ordinary differential equations. It's often helpful in control problems to rearrange these ordinary differential equations into state-space form. This means that we represent the differential equations in the form x = f(x, u). Where x is a matrix of states and u is a matrix of inputs. We can do this in a very systematic manner. Suppose we have an ordinary differential equation governing a one dimensional system whose position is represented by y. We first identify the order of the system n. Recall that the order is the highest derivative that appears in the differential equation. We then define the states x1, which is the position y, and x2 the first derivative of y, and so on until we define a state for the n minus first derivative of y. Next, we create the state vector x, which is a vector containing the previously defined states. These states are governed by the following set of coupled first-order differential equations. We see that because of the way we've defined the states, the first equation simply states that the derivative of x1 is x2. The second equation tells us that the derivative of x2 is x3. The only non-trivial differential equation is the derivative of xn which could be a function of all the other states plus the input u. We get this function by rearranging the governing ordinary differential equation. Finally, we stock these first-order differential equations into a matrix. On the left hand side, we have the matrix x dot. On the right hand side we have a matrix whose components are functions of the state's x and the input u. Consider the Mass-Spring system we previously examined. Governed by the shown ordinary differential equation. The highest derivative that appears in this equation is the second derivative, making this a second order system. We need to define the states x1=y and x2=y dot. Next, we create the state vector x, in this case x contains only two components, y and y dot which we have designated as x1 and x2. We can now define the system of first-order or differential equations. The first equation is trivial and simply states that the derivative of x1 is x2. We get the second equation from solving for y double dot using the governance ordinary differential equation. We see that the derivative of x2 is a function of x1 and u. We can write these two differential equations as a matrix. We see that because k and m are constants, the system's actually linear in the states and input. As a result, we can write the equations in the following manner. We see that this equation is in the form x dot = Ax + Bu, which is the general form for a linear state's base equation. Again the matrix equation is linear and the state's x and the input's u. We can demonstrate how to extend this procedure to higher order systems by using the Planar Quadrotor Model. From lecture we know the Planar Quadrotor is governed by the following set of ordinary differential equations which are written in the terms of the variables y, z and phi. Here, the highest derivative appearing in any differential equation is the second derivative. So this is still a second order system. Next, we essentially must carry out the required steps for each variable. Because n equals two, we need define states for the position and velocity of y, z, and phi. This gives us a system with six states. These six states are placed into one state vector. We can now define the system of first-order differential equations. Again, the first three equations simply relate states to each other. The last three equations come from rearranging the three governing ordinary differential equations. We can now place these equations into a single matrix equation. These equations are non linear because of the functions sin and cosine of the state x three.