4.0

4.0 | 1 rating Rate this file 12 downloads (last 30 days) File Size: 3.43 KB File ID: #11964

lagrange interpolation and derivative

by Geoff Wawrzyniak

 

14 Aug 2006 (Updated 24 Aug 2006)

No BSD License  

This function performs the Lagrange interpolation of a function and its derivative.

Download Now | Watch this File

File Information
Description

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

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

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.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
Lagrange polynomial interpolation
This submission has inspired the following:
Lagrange Interpolator Polynomial

MATLAB release MATLAB 7.0.4 (R14SP2)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
09 Aug 2008 dudu zama  
Please login to add a comment or rating.
Updates
24 Aug 2006

Found error in the description of input arguments. Polished up code per the code metrics.

Tag Activity for this File
Tag Applied By Date/Time
approximation Geoff Wawrzyniak 22 Oct 2008 08:34:59
interpolation Geoff Wawrzyniak 22 Oct 2008 08:34:59
lagrange Geoff Wawrzyniak 22 Oct 2008 08:34:59
derivative Geoff Wawrzyniak 22 Oct 2008 08:34:59
differential Geoff Wawrzyniak 22 Oct 2008 08:34:59

Contact us at files@mathworks.com