MATLAB: Order of the Matlab Ode Solutions Appearing at Output

odeode15ode23ode45orderoutput

When solving higher order differential equations using an ode solver (for example [t,y]=ode15i…), there are many outputs in y such as v1(t), v2(t), v3(t), Dv2t(t), Dv3t(t), Dv4t(t).
How do these signals appear at output (y) of the ode solver? What is their order?
In other words, what should I expect to get at y(:,1), y(:,2),…,y(:,end)?

Best Answer

Hi,
unfortunally Matlab sometimes changes the order of outputs to an order which appears not be logical (at least for me). I dont know why this happens, but it does in some cases. For ODE's it is a good idea to call odeToVectorField with two output arguments like shown here. The order of new_vars is corresponding to the output arguments of y, if you use matlabFunction to create the function handle.
In case of DAE the usage of reduceDAEIndex needs two output arguments which are new_eqs and new_vars. The usage of daeFunction needs both inputs, so that i would expect the order of the input vector for new_vars as the order of the output. But to be honest, for DAE i have no experiences.
Best regards
Stephan
Related Question