how to find numerical derivative of function inside system of Diff equations ?
1 view (last 30 days)
Show older comments
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= % 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
how to find numerical derivative of v without entering the exact expression of it's derivative ?
then solve the DRV function
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])
3 Comments
Jan
on 23 Jul 2018
Then you have to define a suitable delta_x. This is not trivial, because the cancellation error and the discretization error compete with each other. To find the optimal step width, the 2nd derivatives are required, but usually expensive.
A rough estimation might be delta_x = sqrt(eps(v)) and then try the formula you have given already. A two sided differential quotient is more stable, but twice as expensive.
Answers (0)
See Also
Categories
Find more on Statics and Dynamics in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!