FUNCTION REFERENCE

fnval

Evaluate a piecewise polynomial function.

Evaluate a piecewise polynomial function.

Syntax

v = fnval(f, x)

f is a pp structure (mkpp, spline, pchip, makima, csaps, csapi, csape) or a B-form structure (spmak, spap2, spaps). For a pp the result is ppval(f, x); a B-form is the sum of its coefficients times the B-splines, zero outside [knots(1), knots(end)] and continuous from the left at knots(end). One component keeps the shape of x; d components give a d-by-numel(x) matrix. fnval(x, f) is accepted as well.

Example

fnval(mkpp([0 1 2], [1 0; 2 1]), [0.5 1.5])   % [0.5 2]

Example

fnval(spmak([0 0 1 2 2], [1 3 2]), [0.5 1 1.5])   % [2 3 2.5]

Differences from MATLAB: the left-limit argument and multivariate (tensor-product) functions are not supported yet.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.