MATLAB: Solving ODE, 2nd degree using dsolve function. How to simplify the answer

dsolvesimplify

The answer I am getting is exponential with an iota as the power. I want to get in terms if sin and cos and a simplified answer. How do I do it?

Best Answer

I am not certain exactly what you want.
To simplify a result, use the simplify 'steps' option, and to express a result in terms of sine and cosine, use rewrite with the 'sincos' option:
syms A w f1(t) f2(t)
f1(t) = 1;
F1(w) = int(f1*exp(1i*w*t), -1, 1)
F1(w) = simplify(F1(w), 'steps', 10)
f2 = t;
F2(w) = int(f2*exp(1i*w*t), 0, 1)
F2(w) = rewrite(F2(w), 'sincos')
producing:
F1(w) =
(2^(1/2)*sin(w)*1i)/((w*1i)^(1/2)*((w*1i)/2)^(1/2))
F1(w) =
(2*sin(w))/w
and:
F2(w) =
- exp(t*1i)*1i + 1i
F2(w) =
sin(t) - cos(t)*1i + 1i