Re: fsolve problems



"Miroslav Balda" <miroslav.nospam@xxxxxxxx> wrote in message
<fs6nsh$hur$1@xxxxxxxxxxxxxxxxxx>...
"Jacob McFarland" <jacob.a.mcfarland@xxxxxxxxx> wrote in
message <fs6egh$98h$1@xxxxxxxxxxxxxxxxxx>...
Hello,
Let me start by saying im a pretty basic user for matlab.
Im no beginer but definately not a professional.
I am trying to solve a nonlinear system of equations for a
combustion problem. I need to know if there is a way to
force fsolve to only look for real roots. It is unable to
find an answer so far but it always moves into complex
numbers. The roots will not be complex or negative if they
actually exist. Can someone tell me if i can limit the
roots it looks for to only real positive numbers?
Also how many itterations should i allow it to use? I am in
the realm of 1e6 for itterations and function evaluations.
This does not take too long on my computer but it doesnt
seem to help it find any better of a solution.
Thanks,
- Jacob

Hi Jacob
I see that nobody, who has the Optimization Toolbox answers.

Remember that this is over a weekend for those
who might respond, a holiday weekend at that.

The reason why your solutions are going complex
is typically due to a problem of domain. For
example, suppose your function has the variable
a. a is unconstrained, but inside the function
you take log(a). Suppose fsolve tries to evaluate
the objective for negative values of a. SURPRISE!
Complex numbers result. They "contaminate" the
arithmetic, and suddenly fsolve is working in the
complex domain.

One solution is to constrain your parameters.
While fsolve will not accept explicit constraints,
you can use a solver like lsqnonlin.

Alternatively, use a transformation of variables.
If you will compute log(a) inside your objective,
then use a transformation of the variable.

b = log(a)

or, more importantly,

a = exp(b)

Whereas a must be non-negative for happy
completion of fsolve, b is unconstrained.

HTH,
John
.



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)