help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fzero tolerance issue ... and a related bug


From: Martin Helm
Subject: Re: fzero tolerance issue ... and a related bug
Date: Thu, 18 Oct 2012 20:22:30 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1

Am 18.10.2012 19:46, schrieb Joza:
> So related to all that above, how does one find the root of a function that
> is always positive, or zero, but never negative? For instance, an absolute
> value:  f(x) = abs(x - 2)
>
> This has root 2, but I can't give it an initial bracket [x1,x2] since
> f(x2)*f(x2) >= 0.
> Indeed, how could fzero even find an initial bracket?
>
> So how can one solve such a simple equation with fzero?
>
You simply do not solve such an equation with fzero since it does not
belong to the class of equations fzero is made for, instead use fsolve
fsolve( @(x) abs(x-9.1)^4.5, 8, optimset("TolFun", 1e-20))
ans =  9.0999



reply via email to

[Prev in Thread] Current Thread [Next in Thread]