<< CL_intervUnion Math CL_legendrePoly >>

CelestLab >> Math > CL_lagrangeFitPoly

CL_lagrangeFitPoly

Lagrange polynomial

Calling Sequence

[p, pdot, p2dot] = CL_lagrangeFitPoly(xref, yref)

Description

Parameters

xref:

Reference abscissae. (PxN)

yref:

Corresponding ordinates. (PxN)

p:

Lagrange polynomials. (1xN)

pdot:

First derivative of the polynomials. (1xN)

p2dot:

Second derivative of the polynomials. (1xN)

Authors

See also

Examples

// Generate a degree 2 Lagrange polynomial
xref = [-1; 0; 2];
yref = 1 - xref + xref.^2;
p = CL_lagrangeFitPoly(xref, yref) // => 1 - x + x^2

// Vectorized form
xref = [[-1; 0; 2], [-2; 1; 4]];
yref = 1 - xref + xref.^2;
p = CL_lagrangeFitPoly(xref, yref) // => 1 - x + x^2 (2 times)

Report an issue
<< CL_intervUnion Math CL_legendrePoly >>