Message Boards Message Boards

1
|
2663 Views
|
3 Replies
|
3 Total Likes
View groups...
Share
Share this post:

How can I read/deduce matrices A, B, C, and D in state space?

Posted 1 year ago

Hello,

I am trying to convert a continuous time transfer function to its equivalent continuous state space representation, and I can't figure out what the matrices A, B, C, and D would be in Mathematica.

Matlab:

https://www.mathworks.com/help/signal/ref/tf2ss.html

enter image description here

enter image description here

Mathematica:

Result = TransferFunctionModel[(2*s + 3)/(s^2 + 0.4*s + 1), s]
m1 = StateSpaceModel[Result]
TransferFunctionModel[m1][s]

enter image description here

My question here is how to deduce/read the matrices A, B, C, and D in Mathematica from that syntax StateSpaceModel, just as it shows in Matlab when you want to switch from the transfer function to its equivalent state space representation? Is it possible such a thing, as Matlab can do?

Mathematica 13.2 Notebook file attached.

Thank you.

Attachments:
POSTED BY: Cornel B.
3 Replies

As pointed out, the matrices can be obtained using Normal.

tfm = TransferFunctionModel[(2*s + 3)/(s^2 + 0.4*s + 1), s];
ssm = StateSpaceModel[tfm];
{a, b, c, d} = Normal[ssm];
MatrixForm /@ {a, b, c, d}

enter image description here

State space representations are not unique. Matlab ordered the states differently. To get that result in this case, do

MatrixForm /@ Normal[StateSpaceTransform[ssm, {{0, 1}, {1, 0}}]]

enter image description here

POSTED BY: Suba Thomas
Posted 1 year ago
Normal@m1
MatrixForm /@ Normal@m1

enter image description here

It seems that Mathematica rotates the lines between them and the columns between them...

POSTED BY: Cornel B.

Not my area of expertise...

Normal@m1
MatrixForm /@ Normal@m1

Looks like maybe a difference in row/column representation?

POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract