<< 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

// 1) Generate a degree 3 polynomial
xref = [-1; 0; 1];
yref = [1; 2; -1];
p = CL_lagrangeFitPoly(xref, yref)

// Check results
horner(p, xref) // => yref

// 2) Vectorized form (use previous result)
xref = [[-1; 0; 1], [0; 1; 2]];
yref = horner(p, xref);
p2 = CL_lagrangeFitPoly(xref, yref)

// Check results
p2 - [p,p] // => [0,0]

Report an issue
<< CL_intervUnion Math CL_legendrePoly >>