I am using ode45 function to find numerical solution for my system of equations, where I have 4 equations and 4 variables, with command:
sol=ode45(@fun,[1 0],[1; 0; 0; 0])
where time span is going from 1 to 0, and initial conditions are 1,0,0,0.
So, I need to find numerically the first and the second derivative of my values according to time. For the first derivative I have verified code
[~,SXINT]=deval(sol,sol.x);
where in SXINT are stored first derivatives of all 4 variables.
But I don`t know how to find the second derivative numerically. I tried:
[~,SXINT2]=deval(SXINT,sol.x);
but I got error:
SXINT must be a structure returned by a differential equation solver.
How to make that SXINT be in that structure, or is there some other way to find the second derivative, but with the same precision as deval method is with ode45 solver?
Best Answer