<< CL_evalPoly Math CL_gcd >>

CelestLab >> Math > CL_fsolveb

CL_fsolveb

Zero of function knowing bounds

Calling Sequence

[x, y, info] = CL_fsolveb(fct, x1, x2 [, args, ytol, dxtol, meth, y1, y2]);

Description

Parameters

fct:

(function) Function with interface: y = f(x, ind, args)

x1, x2:

Interval containing the solution. (1xN)

args:

(optional, any type) Argument passed to "fct" function. Default is [].

ytol:

(optional) Tolerance on fct(x). (1x1)

dxtol:

(optional) Tolerance on change in x. (1x1)

meth:

(optional) Option of algorithm ("s", "d", "ds", "s2"). Default is "s".

y1:

(optional) Value of fct at x1. (1xN)

y2:

(optional) Value of fct at x2. (1xN)

x:

value such that fct(x) = 0. (1xN)

y:

Exact value of fct at x. (1xN)

info:

(integer) Additional information. 0 means "OK".

Authors

Examples

// Example 1: Solves: sin(x) = 0.1
function [y]=fct(x, ind, args)
y = sin(x) - 0.1;
endfunction
[x, y] = CL_fsolveb(fct, -1, 1);

// Example 2: Solves: sin(x) = [0.1, 0.2, 0.3, 0.4, 0.5]
clear fct;
function [y]=fct(x, ind, args)
y = sin(x) - args(ind);
endfunction
n = 5;
args = (1:n) / 10;
x1 = -1 * ones(1,n);
x2 =  1 * ones(1,n);
[x, y, info] = CL_fsolveb(fct, x1, x2, args, ytol=1.e-12);

Report an issue
<< CL_evalPoly Math CL_gcd >>