Fixed in 10.1
I must be doing something wrong, but do not see it. There is an option in Mathematica control system function StateSpaceModel
where one asks it to generate the state space model in the ControllableCompanion form. This should produce state space A,B,C,D where the B matrix (for one input) will have zeros except for one entry, as shown in the above link. Here is screen shot:
But when I try this on a proper transfer function, I do not get this form.
The problem only shows up when I enter the system as differential equation. If I enter the system directly as transfer function, then I do get the correct form.
Below, the I enter the differential equation, ask for SS, it is not controllable form. Yet, the transfer function is correct. If I take the transfer function generated, and ask for SS, now the state space show up in controllable form.
tf=TransferFunctionModel[{{(4+2s+3 s^2+4 s^3)/(-7-2 s+6 s^2+s^3)}},s];
ss = StateSpaceModel[tf, StateSpaceRealization -> "ControllableCompanion"]
The above is correct. Now trying from the differential equation itself, which has the above transfer function:
eq=y'''[t] +6 y''[t] -2 y'[t] -7 y[t]== 4 u'''[t] + 3 u''[t] + 2 u'[t] + 4 u[t];
ss = StateSpaceModel[{eq}, {{y'''[t], 0}, {y''[t], 0}, {y'[t], 0}, {y[t], 0}},
{{u[t], 0}}, {y[t]}, t, StateSpaceRealization -> "ControllableCompanion"]
Lets check to see if the above ODE has the same TF as before:
Simplify@TransferFunctionModel[ss]
It is the same. So when entering the system as DE, I do not get the controllable form. But same system entered as TF gives the the controllable form.
Any one sees what I am doing wrong? Mathematica 10.0.0 on windows 7
StateSpaceRealization
option was being ignored since v8 (and probably in CSP as well.) The fix should be in the next release. $\endgroup$