Re: an urgent problem about fsolve
- From: ellieandrogerxyzzy@xxxxxxxxxxxxxxxxxxxxxx (Roger Stafford)
- Date: Tue, 09 May 2006 22:06:28 GMT
In article <ef34a72.-1@xxxxxxxxxxxxxxxx>, "Nelson Lee" <s041267@xxxxxxxxx>
wrote:
Hi,----------------------
I am a student and now trying to learn how to use matlab.
When I try to solve two nonlinear equations using fsolve, the result
is "Optimization terminated: first-order optimality is less than
options.TolFun"
So, may I ask what does it mean?
The two equations are
1) 5*(1-.2*R)-(1+.05)*3+1-2*X-(1+.05)*2(1-.2*R)
2).2*5*X+(1+.05)*.2*2*(1-X-R)-(2*R)/(1-X)-(1+.05)*2(1-.2*R)
and I try to find out the value of X and R.
What should I do if I want to have numerical outputs?
Thanks a lot,
Nelson
I don't have 'fsolve' on my system so I can only guess what the trouble
is, and I have no idea what the error message signifies. However, I
strongly suspect your denominator of (1-X) in the second expression is
giving 'fsolve' some serious difficulty. The problem can be resolved as
the simple solution to a quadratic equation with two roots for X and R.
The two root values for X lie on opposite sides of X = 1, at X = 15.3066
and X = 0.4805, so 'fsolve' may encounter difficulties working its way
across this singularity. Why don't you multiply the second expression by
X-1 to avoid this problem? Doing so would not change the solution.
To get both these roots it will probably be necessary to use two
different values for the initial vector estimate [X0,R0]. By the way, the
Symbolic Math Toolbox's 'solve' solves this problem quite handily.
(Remove "xyzzy" and ".invalid" to send me email.)
Roger Stafford
.
- References:
- an urgent problem about fsolve
- From: Nelson Lee
- an urgent problem about fsolve
- Prev by Date: Wait until variable is in workspace
- Next by Date: Re: from a beginner: can these 4 fragments be speeded up/vectorized?
- Previous by thread: an urgent problem about fsolve
- Next by thread: Displaying a Matrix Containing Hex Numbers
- Index(es):
Relevant Pages
|