can fsolve be used to generate values of an equation for different time steps?

2 ビュー (過去 30 日間)
Urvi
Urvi 2012 年 10 月 20 日
I want to know whether fsolve can be used to solve an equation of the form, X=somefunction of X. I want to get values of X at different time steps. For example consider the following equation,
X/(1-X)+(y1-y2)/90=1
y1 and y2 are to be calculated from ordinary differential equations. I am using ode45 to solve it.
Can the solver return a new value of X at every time step and use that in the next time step? If yes how can I solve it?
Thanks!

回答 (2 件)

Matt J
Matt J 2012 年 10 月 20 日
編集済み: Matt J 2012 年 10 月 20 日
Yes, you can make a system of equations, (one equation for each time step) and have FSOLVE solve the total system.
However, it might be better to loop over the time steps and solve each equation separately instead. If X is expected to change smoothly with time, a loop will let you take advantage of that: you can initialize with the result of the previous time step
X(t) = fsolve(...,X(t-1))
helping the solver find the solution faster.
  3 件のコメント
Urvi
Urvi 2012 年 10 月 20 日
I have 12 algebraic equations and 6 odes, all of which are inter related.
Matt J
Matt J 2012 年 10 月 20 日
編集済み: Matt J 2012 年 10 月 20 日
Examples on the use of fsolve? That would be here.

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


Matt J
Matt J 2012 年 10 月 20 日
Note, the ability of FSOLVE to solve this could depend on y1,y2 and how they are related to X. Generally speaking, you need to be able to cast the problem in the form
F(X)=0
where F is a differentiable function. So, y1,y2 would probably have to be differentiable functions of X.

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by