<< CL_detectSign Math CL_dot >>

CelestLab >> Math > CL_detectZero

CL_detectZero

Zero crossing detection

Calling Sequence

[xres, yres] = CL_detectZero(x, y [, direct, ytol, xbounds, opts])

Description

Parameters

x:

Abscissae. (1xN)

y:

(1xN or list) Corresponding ordinates or list(function, ...). See above for details.

direct:

(string, optional) "incr"=increasing, "decr"=decreasing, "any"=both. Default value is "any".

ytol:

(optional) Accuracy on y (empty <=> default value). Default value <= max(abs(y)) / 1.e8.

xbounds:

(optional) Abscissae intervals where the results are looked-for. Default value is [-%inf, %inf]. (2xQ)

opts:

(structure, optional) Additional options - see above

xres:

Abscissae of solutions. (1xP)

yres:

Ordinates of solutions. (1xP)

Authors

See also

Examples

x = 0 : 10;
a = 0.99;

// Example 1: Data interpolation
y = sin(x) - a;
xres = CL_detectZero(x,y);
sin(xres) - a  // => ~0 (includes effect of interpolation errors)

// Example 2: User-defined function
function [y]=myfunction(x, c)
y = sin(x) - c;
endfunction
xres = CL_detectZero(x, list(myfunction, a));
myfunction(xres,a)  // => 0 (more accurate)

Report an issue
<< CL_detectSign Math CL_dot >>