3
$\begingroup$

Mathematica by default puts state space model realizations in controllable companion form, as seen here:

tfsys = TransferFunctionModel[(b1 s^2 + b2 s + b3)/(s^3 + a1 s^2 + 
      a2 s + a3 ), s];
StateSpaceModel[tfsys]

Which outputs a block matrix like: $$ \begin{bmatrix}0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ -a_3 & -a_2 & -a_1 & 1 \\ b_3 & b_2 & b_1 & 0\end{bmatrix} $$ However, I want it in controllable canonical form, which should look like: $$ \begin{bmatrix}-a_1 & -a_2 & -a_3 & 1 \\ 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ b_1 & b_2 & b_3 & 0\end{bmatrix} $$ StateSpaceModel offers the StateSpaceRealization option but it only has ControllableCompanion and ObservableCompanion, neither of which is what I want. Is there a simple way of getting the right state space form?

$\endgroup$
1
$\begingroup$
StateSpaceModel[TransferFunctionModel[(b1 s^2 + b2 s + b3)/(s^3 + a1 s^2 + a2 s + a3), s]]

enter image description here

And we can get the form you want by selecting the states in the desired order.

SystemsModelExtract[%, All, All, Reverse@Range@3]

enter image description here

There doesn't seem to be a consensus on which of the above is the correct 'controllable canonical form'. Here are some sources (link, link) that call what is returned by Mathematica as the controllable canonical form.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.