View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Lagrange polynomial interpolation

3.8 | 32 ratings Rate this file 82 Downloads (last 30 days) File Size: 582 Bytes File ID: #899 Version: 1.0

Lagrange polynomial interpolation


Carlo Castoldi (view profile)


07 Oct 2001 (Updated )

Lagrange polynomial interpolation

| Watch this File

File Information

Approx a point-defined function using Lagrange polinomial interpolation method


This file inspired Barycentric Lagrange Interpolating Polynomials And Lebesgue Constant, Lagrange Interpolation And Derivative, Lagrange Interpolator Polynomial, and Piecewise Hermite Cubic Interpolation.

MATLAB release MATLAB 5.2 (R10)
MATLAB Search Path
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (41)
23 Dec 2016 mohammadreza bayat

08 Dec 2016 cyrine belhassen

06 Nov 2015 Moonwards

Thanks, very good.

02 Nov 2015 Bayram Can İnce

good job

09 Jul 2014 Marco Castelli

Very effective

16 Aug 2012 Xiangbin Guo

if you can explain in the behind of the code,it will be much better,thank you very much

28 Feb 2012 Tiffany

I do not understand why you need ",2" when you are determining the size of pointx. Why can't you just code n=size(pointx)? I am new to matlab, can someone explain?

Comment only
25 Oct 2011 Andrew

Andrew (view profile)

To answer some of those questions here is an example of input:
where [x0,...,xn] is pseudo-code for representing the x values as an array and [f(x0),...,f(xn)]. Then try to plot that lagrange against the function you are interpolating and you should see the desired results.

Comment only
15 Jun 2011 BobAlpha

15 Mar 2011 Juan Camilo Medina

Simple yet functional code. Thanks

23 Nov 2010 madinatul munawaroh

anyone can give me example how to use it?
i need it for my study...

Comment only
11 Apr 2010 naser Rashwan

how to represent x, i represent the x as [1 0] but it did not give the right answer

Comment only
08 Dec 2009 Angela

Angela (view profile)

and what exactly do you have to give as input??

15 Oct 2008 pamonz wank

21 Aug 2008 sanjay zine

30 May 2008 Satya Sudhakar Yedlapalli

Can be made as a basic matlab function

Comment only
04 May 2008 mahesh nair

29 Feb 2008 LAY Nary

I don't know

Comment only
03 Nov 2007 Pier Francesco Maria Gatti

what is x? :D

25 Oct 2007 hira manzoor

14 Jun 2007 Arc .

Very usefull - I need it for convertion to java code.

03 Jun 2007 imran aslam

07 Oct 2006 John D'Errico

Lagrange interpolation is one of those interpolation methods that beginning textbooks include, along the way to showing you some useful methods. I imagine the textbook authors want to show you some of the history of interpolation. The fact is, high order Lagrange interpolation of this ilk was a only ever a good idea BACK IN the time of Lagrange. There has actually been progress in knowledge since then. (Surprise!) This is a terribly poor choice of interpolation method today.

In general, splines or other methods like them (PCHIP) will be less likely to introduce interpolation artifacts, oscillations, etc. Splines will be FAR less sensitive to tiny amounts of noise than will a high order Lagrange.

Even if I choose to disregard the method it implements,
the code itself is poorly implemented. It is triply looped - totally unvectorized. Expect it to be slow and if you have a large number of points, it will take more memory than need be.

If you need to use an interpolation tool, start with interp1, spline, or pchip, or look to the splines toolbox for more choices.

28 May 2006 Jose Garcia

21 May 2006 haris ahmad

i am a student of electronics engr and hav to do numerical diff using lagrange

Comment only
09 Nov 2005 Haroon Awais

good work, but it is better to use Matlab "interp1" function.

25 Oct 2005 Jev Jeg

05 Oct 2005 frederico schultz

muito obrigado...boa sorte



Comment only
31 May 2005 T B

Great job!!! Good work!

11 May 2005 JJ LS

Very Good

22 Apr 2005 bill cosby

Thank you for a great program

09 Mar 2005 im einnor

flawless program!

10 Feb 2005 Aleksey Rozsdobudko

what did u write?????? It can write even a child!!!!
dont use such words as "for","while" and anything like that in the matlab cos it's STUPPIDNESS!!!!!!

30 Aug 2004 Fahad Abbassi

Man u r a king and matlab is your bitch!!

23 Nov 2003 sima asgari


24 Sep 2003 Sukant Gupta

30 Apr 2003 t t


20 Feb 2003 oziel alcocer

22 Jan 2003 keene rolph

The source code is very is good for research especially for mathematics purpose.

Comment only
15 Jan 2002 steve xia

31 Mar 2016 1.0

Changed header inside file

Contact us