On 4 Jul., 12:18, "Hermano Cappa" <cappaste...@gmail.com> wrote:
> Torsten <Torsten.Hen...@umsicht.fraunhofer.de> wrote in message <3bb79a5786484e0e84e58f773ce4c...@29g2000yqb.googlegroups.com>...
> > On 4 Jul., 10:08, Torsten <Torsten.Hen...@umsicht.fraunhofer.de>
> > wrote:
> > > On 4 Jul., 09:26, "Hermano Cappa" <cappaste...@gmail.com> wrote:
>
> > > > "Matt J" wrote in message <iupmgd$fa...@newscl01ah.mathworks.com>...
> > > > > "Hermano Cappa" wrote in message <iuph9i$3c...@newscl01ah.mathworks.com>...
> > > > > > Hi,
>
> > > > > > I'm using the fzero command for calculating the zero of a nonlinear problem. With the command "TolX" I set the tolerance on the xvalue. My question is: Is there a way to set the tolerance on the zerovalue instead on x? Because when your function is really flat around zero, the tolerance on x does not ensure that this value is short to the zero of the function.
> > > > > ===============
>
> > > > > I think you're looking for TolFun.
>
> > > > Hi Matt,
>
> > > > There's a table listing the five options that FZERO uses from the options
> > > > structure: Display, FunValCheck, OutputFcn, PlotFcns, and TolX. TolFun is
> > > > not listed in that table.
>
> > > fzero uses bisection  thus choosing a smaller value for TolX will
> > > automatically
> > > decrease f(x).
>
> > > Best wishes
> > > Torsten.
>
> > ... and  assuming that your function is continuous 
> > you can be sure that there really _is_ a zero
> > in the TolXneighborhood of the solution found by fzero.
>
> > Best wishes
> > Torsten.
>
> Torsten thanks for the input. But regarding your answer, setting a value to TolX , even it is very small, don't say anything on the accuracy of your zero. This totally depends on the steepness of the function. So if in one case, the function is steeper, the accuracy of the zero will be different (worse). Therefore I need to set the tolerance on the zero value. Zitierten Text ausblenden 
>
>  Zitierten Text anzeigen 
Usually it suffices to know that a zero is located within [xTolX;x
+TolX] where x is the solution provided by fzero 
and this is guaranteed by the bisection method.
A way to improve accuracy is to evaluate f at the suggested solution x
and  if f(x) is too big  choose
a smaller value for TolX.
Or you use MATLAB's fsolve which has the option to choose the error
tolerance TolFun on the function value .
Best wishes
Torsten.
