Contents Previous Next Subchapters Current Chapters-> interp interp1 lagrange polyfit smospl cubespl cubeval interp2 mlmode_interp2 snewton brent linlsq linlsqb nlsq dnlsq nlsqbox dnlsqb conjdir neldermead conjgrad minline lemke Qpos Qbox Qpro sqp relative fordiff cendiff autodiff testder testgrad testhess Parent Chapters-> Omatrix6 fit lagrange Search Tools-> contents reference index search

Lagrange Polynomial Interpolation
 Syntax `lagrange(`xd`, `yd`, `xi`)` See Also polyfit , cubespl , interp , interp2

Description
Returns the value of the Lagrange interpolating polynomial of a column vector valued function at a point. The interpolating polynomial has degree that is one less than the column dimension of xd and is equal to the j-th column of yd at the j-th element of xd. The row vector xd specifies the argument values that the polynomial interpolates. The real, double-precision, or complex matrix yd specifies the function values that the polynomial interpolates. The parameters yd and xd must have the same number of columns. The scalar xi specifies the point at which to evaluate the polynomial. If yd is real or double-precision, xd and xi must have the same type as yd. If yd is complex, xd and xi must be double-precision. The return value will have the same type as yd.

Example ```      xd = [-1., 0., 2.]      yd = [+1., 0., 4.]      xi = 3.       print lagrange(xd, yd, xi) ``` returns ```      9 ```