How can I get MATLAB to solve a system of equations containing differential and algebraic equations?
古いコメントを表示
I have a system of about 40 equations, about half are ordinary differential equations (that must be solved numerically), the other half are simple algebraic equations, but all rely on variables solved for in the other type. I have been trying to use ode45 to solve the system, but the variables solved for in alegraic equations do not update with time steps, even though the variables used to calculate them are changing. For example, if i have dx1/dt = t, x2 = x1+5, and I use t=0:10, x1 changes with t, but x2 remains constant, even though it should change with x1. Has anybody else had this problem or know a way around it?
1 件のコメント
Muthu Annamalai
2013 年 6 月 28 日
Clearly once your write your system of ODEs in a explicit form
d X/dt = F(X,t,t0)
you can use ODE45, my preferred solver. For DAE you can use, ode23t http://www.mathworks.com/help/matlab/ref/ode23t.html
採用された回答
その他の回答 (1 件)
Marc
2013 年 6 月 29 日
0 投票
See ODE15s documentation on this and you will want to define your mass matrix as being either constant or as a function call within the ODE options. Torsten gave a good example of this in the newsgroup. Search there. If I find it, I will post the link.
If your mass matrix is not constant and it sounds like it is not, you will need to define a function massMat...... And use the @massMat in the options to let ode15s know to use this.
カテゴリ
ヘルプ センター および File Exchange で Ordinary Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!