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 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