How do I use ode45 for descriptive form?

조회 수: 2 (최근 30일)
Tawsif Khan
Tawsif Khan 2014년 8월 11일
댓글: Tawsif Khan 2014년 8월 12일
What would be the most efficient way to solve,
A1x'(t) = A2x(t), where both A1 and A2 are nxn matrices.
Both are sparse matrices and hence I want to avoid inversion.

채택된 답변

Yu Jiang
Yu Jiang 2014년 8월 11일
편집: Yu Jiang 2014년 8월 11일
You may solve it as a DAE (differential algebraic equation), instead of an ODE.
This documentation (Link) mentions the DAE in the form of
M(t,y)y′ = f(t,y)
Your example is a special case of this form. It can be solved by ode15s and ode23t solvers. Using those solvers, you can directly specify the M matrix without the need to invert it.
Basically, you define a function as
function dx = mySys(t,x)
dx = A2*x;
end
Then, before you solve it using ode solvers ode15s and ode23t, specify
options = odeset('Mass',A1);
Next, apply the option when using the solver as follows
[t,y] = ode15s(@mySys,tspan,y0,options);
More examples can be found in the documentation .
  댓글 수: 3
Yu Jiang
Yu Jiang 2014년 8월 12일
편집: Yu Jiang 2014년 8월 12일
I think it is because they use different numerical methods. See the following link for details:
-Yu
Tawsif Khan
Tawsif Khan 2014년 8월 12일
Thanks, this really helped.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by