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

3 Ansichten (letzte 30 Tage)
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!

Antworten (2)

Matt J
Matt J am 20 Okt. 2012
Bearbeitet: Matt J am 20 Okt. 2012
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 Kommentare
Urvi
Urvi am 20 Okt. 2012
I have 12 algebraic equations and 6 odes, all of which are inter related.
Matt J
Matt J am 20 Okt. 2012
Bearbeitet: Matt J am 20 Okt. 2012
Examples on the use of fsolve? That would be here.

Melden Sie sich an, um zu kommentieren.


Matt J
Matt J am 20 Okt. 2012
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.

Community Treasure Hunt

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

Start Hunting!

Translated by