


sub_COMPUTETRAJECTORY Calculates time evolution of state trajectories subject to control
[X,U,Y,D,cost,trajectory,feasible]=sub_computeTrajectory(ctrl,x0,N,Options)
---------------------------------------------------------------------------
DESCRIPTION
---------------------------------------------------------------------------
For the given state x0, the state, input and output evolution trajectories
are computed.
---------------------------------------------------------------------------
INPUT
---------------------------------------------------------------------------
ctrlStruct - Controller structure as generated by mpt_control
x0 - initial state
N - for how many steps should the state evolution be computed
If horizon=Inf, computes evolution of the state to origin
Options.reference - If tracking is requested, provide the reference point
in this variable (e.g. Options.reference = [5;0])
Options.sysStruct - If provided, we use this system model for simulations
instead of sysStruct which was used to compute the
controller
Options.sysHandle - Handle of a simulation function. If provided, we call this
function to obtain the state update. E.g.:
Options.sysHandle = @di_sim_fun
where "di_sim_fun.m" mut be a function which takes "xk"
and "uk" as input arguments and produces exactly two
outputs - "xn" (state update x(k+1)) and "yn" (output
y(k)). It's the user's responsibility to make sure that
dimensions of state/inputs/outputs match dimensions of the
control law. Take a look at 'help di_sim_fun' for more
details.
Options.randdist - If set to 1, randomly generated additive disturbance
vector will be added to the state equation
Options.openloop - If 1, the open-loop solution will be computed, 0 for
closed-loop trajectory (default is Options.openloop=0)
Options.stopInTset- If set to 1 and user-specified terminal set was
provided when computing the controller, evolution of
states will be stopped as soon as all states lie in the
terminal set for two consecutive steps (i.e. states will
not be driven to the origin).
Options.samplInTset - if Options.stopInTset is on, this option defines how
many CONSECUTIVE states has to lie in the terminal set
before the evolution terminates. Default is 2
Options.minnorm - If closed-loop trajectory is computed, we stop the
evolution if norm of a state decreases below this value
Options.verbose - Level of verbosity
Options.lpsolver - Solver for LPs (see help mpt_solveLP for details)
Options.abs_tol - absolute tolerance
Options.useXU - if 1, use a control input based on an XUset istead of the
usual (optimization) based control action. (default 0)
Note: If Options is missing or some of the fields are not defined, the default
values from mptOptions will be used
---------------------------------------------------------------------------
OUTPUT
---------------------------------------------------------------------------
X, U - matrices containing evolution of states and control moves
Y, D - matrices containing evolution of outputs and disturbances
cost - contains cost from the given initial state to the origin
trajectory - vector of indices specifying in which region of Pn the given state lies
feasible - 1: the control law was feasible for all time instances, 0: otherwise
see also MPT_GETINPUT, MPT_COMPUTETRAJECTORY