Simplify exponential matrix complex output in MATLAB

MATLABmatrix exponential

I want to use MATLAB to find $e^{\mathbf{A}t}$ for
$$\mathbf{X'}=\begin{pmatrix} -3 & -1 \\ \phantom{-}2 & -1 \end{pmatrix}\mathbf{X}$$
this is what I wrote in the command window

A=[-3 -1 ; 2 -1]
syms t
expm(A*t)

And I do get an output, but I want to simplify the output because it is in complex, so I write

simplify(expm(A*t))

but I keep getting the same output. Does anyone have any idea how to simplify it? This was a question from a differential equations textbook, the question was

In the case of complex output, utilize the software to do the simplification.

and that is what I am trying to do here, but it is not working.

Best Answer

Normally, Matlab does not know that your $t$ is the time, i.e., that it is real. And by default it assumes that $t$ is complex. If you want to tell to Matlab that the variable is real, then define it as

syms t real

Then pretty(simplify(expm(A*t))) returns

/                      /     pi \                                  \
| sqrt(2) exp(-2 t) cos| t + -- |,        -exp(-2 t) sin(t)        |
|                      \      4 /                                  |
|                                                                  |
|                                                       /     pi \ |
|        exp(-2 t) sin(t) 2,       sqrt(2) exp(-2 t) sin| t + -- | |
\                                                       \      4 / /