I linearized the nonlinear ODEs describing the dynamics of the planar quadrotor at the equilibrium point: xe = [y1 z1 0 0 0 0]. Then I proceeded to put my equations in state space form x_dot = Ax + Bu and y = Cx. I obtained my A,B,C,D matrices and pass them to Matlab function ss like so:
Sys = ss(A,B,C,D). Then I pass it to lsim to simulate like so:
[Outputs, time, states] = lsim(sys, u, time, x0).
My question is: how do I make sure that all my states and my initial conditions are shifted by the equilibrium points? I understand that my state variables are now written in terms of deviation from the equilibrium point and so: y_tilde = y - ye, z_tilde = z - ze, and for the other 4 state variables x_tilde = x, since xe = 0 for all the other states.
Do I have to manually shift the initial condition x0 to make it x0_tilde before passing it to ss(A,B,C,D)? And how about the outputs from lsim do I have to shift those by xe? Please ask if I can clarify anything I understand how to define the state space system on paper but have no idea how matlab deals with it. Thanks!