Re: an urgent problem about fsolve



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
.



Relevant Pages

  • Re: finding complex root from nonlinear equations
    ... On Jan 3, 5:49 pm, "Roger Stafford" ... I don't know how to find complex roots, ... For polynomial equations the matlab function 'roots' will find all ... advice in their 'fsolve' documentation is "fsolve only handles real ...
    (comp.soft-sys.matlab)
  • Re: fsolve problems
    ... The roots will not be complex or negative if they ... I may not help you with fsolve, which is in that toolbox, ... x is a column vextor, w1, w2 are big enough scalar ... weights or columns of vector weights. ...
    (comp.soft-sys.matlab)
  • Re: finding complex root from nonlinear equations
    ... I know fsolve can find the real roots from polynomial equations, ... I don't know how to find complex roots, ... As to finding all possible roots, 'fsolve' only promises to find one root. ... I can see that polynomial equations can be split ...
    (comp.soft-sys.matlab)
  • Re: Solving non linear equations
    ... I tried to solve these equations using 'fsolve' command, ... This is a problem for 'roots'. ... Then substitute the left hand expression in this equation for z in the third ...
    (comp.soft-sys.matlab)
  • Re: fsolve problems
    ... force fsolve to only look for real roots. ... The roots will not be complex or negative if they ... While fsolve will not accept explicit constraints, ... use a transformation of variables. ...
    (comp.soft-sys.matlab)