Spline Toolbox    
fnval

Evaluate a function

Syntax

Description

Both fnval(f,x) and fnval(x,f) provide the matrix f(x), with the function whose description is contained in f. The output (and input) depends on whether is univariate or multivariate.

If the function in f is univariate, then the output is a matrix of size [d*m,n], with [m,n] the size of x and d the dimension of f`s target (e.g., d = 2 if maps into the plane).

If has a jump discontinuity at x, then the value f(x+), i.e., the limit from the right, is returned, except when x equals the right end of f's basic interval; for it, the value f(x-), i.e., the limit from the left, is returned.

If the optional third input argument is present and is a string beginning with 'l', then, f  is instead made to be continuous from the left. This means that if f has a jump discontinuity at x, then the value f(x-), i.e., the limit from the left, is returned, except when x equals the left end of the basic interval; for it, the value f(x+) is returned.

If the function is multivariate, then the above statements concerning continuity from the left and right apply coordinatewise. Further, if the function is, more precisely, m-variate for some m>1, then x must be either a list of m-vectors, i.e., of size [m,n], or a cell array {x1,...,xm} containing m vectors. In the first case, the output is of size [d*m,n] and contains the values of the function at the sites in x. In the second case, the output is of size [d,length(x1),...,length(xm)] (or of size [length(x1),...,length(xm)] in case d is 1), and contains the values of the function at the m-dimensional grid specified by x.

Examples

The statement fnval(csapi(x,y),xx) has the same effect as the statement csapi(x,y,xx).

Algorithm

For each entry of x, the relevant break- or knot-interval is determined and the relevant information assembled. Depending on whether f is in ppform or in B-form, nested multiplication or the B-spline recurrence (see, e.g., [PGS; X.(3)]) is then used vector-fashion for the simultaneous evaluation at all entries of x. Evaluation of a multivariate function takes full advantage of the tensor product structure.

See Also

ppmak, spmak, fnbrk


 fntlr getcurve