MATLAB: Y”-y’ y=sin(x) +exp(x)

from me

I do not know how to solve it if I do not use dsolve

Best Answer

They are different because odeToVectorField gives you an array you can pass to matlabFunction that will give you an anonymous function you can use directly with ode45 (if you write the matlabFunction call correctly), to get a numeric solution.
The result of your dsolve call gives you the analytic solution to the differential equation.
They are two entirely different results.