フィルターのクリア

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

1 回表示 (過去 30 日間)
Waleed new
Waleed new 2018 年 7 月 23 日
コメント済み: Jan 2018 年 7 月 23 日
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 件のコメント
Waleed new
Waleed new 2018 年 7 月 23 日
編集済み: Waleed new 2018 年 7 月 23 日
yes i can differentiate v with pencil or with symbolic computation in Matlab but I want to see how to do it with finite difference approximation method :
dv(x)/dx=( v(x+delta_x) - v(x) )/delta_x
or like the derivative block in simulink (Output time derivative of input)
Jan
Jan 2018 年 7 月 23 日
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.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeStatics and Dynamics についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by