|
So, really thank you for helpin me.
Esselamu Aleyk?m
Alan Weiss <aweiss@mathworks.com> wrote in message <h3q4ti$79r$1@fred.mathworks.com>...
> Hi, I have good news and bad news. The good news is that two of your
> three "errors" are not errors at all! Your reports ii) and iii) are
> actually good outcomes, meaning fsolve found a genuine root.
>
> The bad news is your report on i) shows complex results. fsolve is not
> designed to deal with complex numbers. Most likely your objective
> function takes a square root or something, and the input is negative
> when you expect it to be positive. So you will have to examine your
> function carefully and remove any possibility that it might return a
> complex number. Also, it is entirely possible for fsolve to fail to
> converge to a solution for some starting points, even if the returned
> values are all real scalars.
>
> FYI, one of my projects has been to help revamp the exit messages in
> Optim. So far, fmincon and fminunc and a few other solvers have enhanced
> exit messages (see
> http://www.mathworks.com/access/helpdesk/help/toolbox/optim/ug/brwvb8m.html#brw34zk
> ). fsolve is on my list to improve. Stay tuned...
>
> Alan Weiss
> MATLAB mathematical toolbox documentation
>
> ?nder wrote:
> > Hi. I get errors in "fsolve" function in my code, for some input values.
> > When i run my code with diffirent input values; for some input values, "fsolve" function gives no-error, then my code gives expected results in the output, but for some input values, the function gives errors which sometimes cause expected, but sometimes cause unexpected results in the output in my code.
> >
> > Using "fsolve" function gave me three diffirent errors that i don't know how to deal with. So, i am giving these three error types, if you have an idea to deal with these errors, may you give it to me?
> > ( i'm using 'fsolve' function to solve two non-linear equations for two unknowns at the same time, also i added the initials that i have at the end)
> >
> > i)
> > Optimizer appears to be converging to a point which is not a root.
> > Norm of relative change in X is less than max(options.TolX^2,eps) but
> > sum-of-squares of function values is greater than or equal to sqrt(options.TolFun)
> > Try again with a new starting guess.
> > 1.0e+002 *
> >
> > 0.0000 + 6.5164i
> > 6.5476 – 0.0000i
> > (when my initials are: ,[-705;200])
> >
> > ii)
> > Optimization terminated: norm of relative change in X is less
> > than max(options.TolX^2,eps) and sum-of-squares of function
> > values is less than sqrt(options.TolFun).
> > -726.0046
> > 146.8141
> > (when my initials are: ,[-705;200])
> >
> > iii)
> > Optimization terminated: relative function value changing by less
> > than max(options.TolFun^2,eps) and sum-of-squares of function
> > values is less than sqrt(options.TolFun).
> > 656.1628
> > 267.2979
> > (when my initials are:,[680;280])
|