I want to solve this system of DE :
function ydot= DRV(y)
B=[1 0.5 4;7.2 0.6 5;3.3 8 0.2];
R1=[2 5 3;11 3 6;1.2 2 4];
Q1=eye(3,3);
qv=[y(1);y(2);y(3)];
p=[y(4) y(5) y(6);y(7) y(8) y(9);y(10) y(11) y(12)];
qvdot=p*qv;
pdot=p*B*inv(R1)*p+Q1;
v=Q1*p*R1*qv;
vdot= % Is there any matlab function to derive v automatically?
zdot=Q1*v+R1*vdot;
pdot=pdot(:);
ydot=[qvdot;pdot;zdot];
ydot(:);
end
how to find numerical derivative of v without entering the exact expression of it's derivative ? for example to invert a matrix A just add inv(A). is there similar function to derive expressions ?
then I will use the function with the ode45:
[t,y]=ode45(@(t,y)DRV(y),[0 10],[0.8224 0.2226 0.4397 0.3604 -1.5 -5.9 -6.5 0 0 0 0 0 0 0.1 0.2])
Try MATLAB symbolic toolbox, you can't calculate the numerical derivative and then use it in another numerical algorithm like Runge-Kutta (ODE45), unless you write your own version of ode solver.