How to find State Transition Matrix in terms of sin and cos if eigenvalues are Complex Conjugate?

Hello,
I am trying to find State Transition Matrix (STM) in MATLAB using "expm(A*t)" command. For real roots, its fine, but when its complex eigenvalues, its going into piecewise mode and not giving the STM in terms of sin or cosine.
A = [0 1 0; 0 0 1; -2 -3 -5];
syms t;
A_STM = expm(A*t)
For this I am getting following STM in truncated form as attached (One Real and Two Complex Conjugate):
But I want answer in the following form (Not for above example), from MATLAB -
Can somebody guide, help?
Thank you.

 Accepted Answer

Use the rewrite function, then simplify:
A = [0 1; -2 -2];
syms t;
A_STM = expm(A*t)
A_STM = rewrite(A_STM, 'sincos')
A_STM = simplify(A_STM, 500)
producing:
A_STM =
[2^(1/2)*exp(-t)*sin(t + pi/4), exp(-t)*sin(t)]
[ -2*exp(-t)*sin(t), 2^(1/2)*exp(-t)*cos(t + pi/4)]
in LaTeX:
.

6 Comments

Thank You Star Strider for your quick response.
I got that answer, but I have a 3rd order system, where one pole is Real and other two are complex conjugates, in that MATLAB going in infinite mode (attached in edited question). Can you please rectify and provide the way?
Thank you
I cannot use the attached file because in the end it mentions
.. Output truncated. Text exceeds maximum line length for Command Window display.
so it would not be possible for me to work with it, and it is difficult for me to even read it.
I suggest that you use code such as I provided and use those functions to rewrite it and simplify it as much as possible. Use:
A_STM = simplify(A_STM,1000)
to be certain that simplify has every opportunity to simplify it as much as possible. Then go do something else for a while, because that is going to take time for MATLAB to simplify and rewrite.
Also use the vpa function if large fractions appear, although that would have no effect on some elements, such as exponents.
Thank you for your solution, but problem not solved. The STM is giving as "piecewise....."
"... Output truncated. Text exceeds maximum line length for Command Window display."
This is when we have 1 real root and 2 complex conjugates (3rd order system).
If only complex roots (2nd order system), then its working.
I have no idea why an expm result would require piecewise, however it may be that your system does not have a symbolic solution. It appears to be so large that the result is likely not tractable in any event.

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!