Lagrange polynomial
[p, pdot, p2dot] = CL_lagrangeFitPoly(xref, yref)
Computes the Lagrange polynomial passing through reference abscissae and ordinates.
xref and yref describe the reference abscissae and ordinates. Each column in xref and yref define a different set of points. The polynomial p(k) is the polynomial that fits the points P=(x,y) such that x=xref(:,k) and y=y(:,k). The (maximum) degree of the polynomial is equal to the number of rows in x and y minus 1.
The function also optionally returns the first and second derivative of the polynomial.
Note:
If the polynomial cannot be computed (because the abscissae are not all different) a constant polynomial equal to %nan is returned. The derivatives are then set to the same polynomial (%nan), which is not necessarily what the Scilab "derivat" function would do.
Reference abscissae. (PxN)
Corresponding ordinates. (PxN)
Lagrange polynomials. (1xN)
First derivative of the polynomials. (1xN)
Second derivative of the polynomials. (1xN)
CNES - DCT/SB