MATLAB: Do I get non-real solution for simple ODE

MATLABode

Hello,
Following code:
syms a real
syms x(t)
assume(x(t), 'real')
ode = diff(x,t) == a*x;
odeSol = dsolve(ode);
isreal(odeSol)
The solution to this simple ode is, according to MATLAB, not real, since
isreal(odeSol)
results in 0. But the solution in reality is of course real.
The imaginary part:
imag(odeSol) = a*imag(exp(t))
Seems like t is not interpreted as real. Any suggestions why this happens?
I have also tried
syms t real
but that does not help either.
Thanks for your help!

Best Answer

syms a x0 real
syms x(t)
assume([x(t), t] , 'real')
ode = diff(x,t) == a*x;
odeSol = dsolve(ode, x(0)==x0);
isreal(odeSol)
Related Question