How to shift state space models by equilibrium points using ss and lsim?

16 views (last 30 days)
Hi everybody,
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!

Accepted Answer

Paul
Paul on 28 Mar 2021
The states, inputs, and outputs of Sys are all perturbations from the equilibrium solution. The intiial condition to lsim (x0) would then be an intiial perturbation from the equilibrium condition. The Outputs and States from the call to lsim are the perturbations to the equilibrium outputs and states. The input u to lsim is the perturbation to the equilibrium solution input.
  6 Comments
Paul
Paul on 28 Mar 2021
Right. You found an equilibrium point at some particular value of the state vector xe. Though unstated, presumably the input at the equilibrium is ue = 0. The output at equilibrium is ye. Now linearize around the xe and ue and ye to develop the LTI state space model sys. The state, input, and output of sys are perturbations to xe, ue, and ye respecitvely. After running lsim, the "global" state xglobal is approximated by xe + x, where x is the state variable of sys. Similarly for yglobal and uglobal. These approximations are valid for small perturbations from the equilibrium point.

Sign in to comment.

More Answers (0)

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!