image thumbnail

lagrange interpolation and derivative

version (1.4 KB) by Geoff Wawrzyniak
This function performs the Lagrange interpolation of a function and its derivative.


Updated 24 Aug 2006

translation missing:

This function performs the Lagrange interpolation of a function (y) or its derivative (dy/dx).

y=lagrange(x,pointx,pointsy,0) or
dy=lagrange(x,pointx,pointsy,1) or

There are two ways to find the derivative. If dydx_on (varargin(4)) is set to 1, it will base the derivative on pointx and pointsy (y will be dy/dx). If dydx_on == 2, the derivative is based on the interpolated points.

pointsy can be an array.

This function can get slow for large amounts of control points. Also, make sure to have extra control points outside the region of interpolation interest if there are lots of control points.

Cite As

Geoff Wawrzyniak (2022). lagrange interpolation and derivative (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R14SP2
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!