FUNCTION REFERENCE

spap2

Least-squares spline approximation.

Least-squares spline approximation.

Syntax

sp = spap2(knots, k, x, y)

Syntax

sp = spap2(knots, k, x, y, w)

Syntax

sp = spap2(l, k, x, y)

The order-k spline with the given knots that minimises sum(w.*(y - f(x)).^2), solved by Givens QR of the banded collocation matrix. A scalar l uses l uniform pieces over the data range (augknt of the breaks). Sites must lie within the knots and satisfy the Schoenberg-Whitney conditions; otherwise an error. y may have one row per component. The result is a B-form.

Example

sp = spap2(augknt([0 2 4], 4), 4, 0:0.5:4, (0:0.5:4).^2); fnval(sp, 3)   % 9

Differences from MATLAB: the knot-improvement step for a scalar l is not done (uniform breaks are used).

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