Class StateSpace#

Nested Relationships#

Nested Types#

Class Documentation#

class StateSpace#

Use provided non-linear equations to create a state space model of the form: x_dot = A*x + B*u, y = C*x + D*u from a nonlinear set of equations of the form x_dot = f(x,u), y = g(x,u)

Public Functions

StateSpace(int num_inputs, int num_outputs, int num_states, lin_fn state_deriv_fn, lin_fn output_fn, std::string_view mode = "forward")#

Create a StateSpace class. This uses non-linear equations to create a state space model of the form: x_dot = A*x + B*u, y = C*x + D*u from a nonlinear set of equations of the form x_dot = f(x,u), y = g(x,u)

Parameters:
  • num_inputs – The number of inputs, u, in the state space model.

  • num_outputs – The number of outputs, y, in the state space model.

  • num_states – The number of states, x, in the state space model.

  • state_deriv_fn – The non-linear function, f, used to create the A and B matrices.

  • output_fn – The non-linear function, g, used to create the C and D matrices.

  • mode – The numerical differencing technique to use. “forward” for forward differencing and “central” for central differencing.

ss generate(const Vec &x, const Vec &u)#

Generate a state space model by linearizing the system about x and u.

Parameters:
  • x – The state vector, x, to generate about.

  • u – The input vector, u, to generate about.

Returns:

A structure with the matrices for the state space model.

struct ss#

State space return type. This holds the A, B, C, and D matrices that make up the state space model.

Public Members

Mat A#

A matrix of the state space model.

Mat B#

B matrix of the state space model.

Mat C#

C matrix of the state space model.

Mat D#

D matrix of the state space model.