如何在 Diff 方程组中找到函数的数值导数?

how to find numerical derivative of function inside system of Diff equations?

我想解决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= % how to derive V with finite difference approximation or any other method
zdot=Q1*v+R1*vdot;
pdot=pdot(:);
ydot=[qvdot;pdot;zdot];
ydot(:);
end

如何在不输入导数的精确表达式的情况下求出 v 的数值导数?

然后求解DRV函数

clc;clear ALL;close all;
[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])

试试 MATLAB symbolic toolbox,你不能计算数值导数,然后将它用于另一个数值算法,如 Runge-Kutta (ODE45),除非你编写自己版本的 ode 求解器。