4.7 | 24 ratings Rate this file 158 Downloads (last 30 days) File Size: 1.69 KB File ID: #4540

Legendre-Gauss Quadrature Weights and Nodes



26 Feb 2004 (Updated )

Computes the Legendre-Gauss weights and nodes for solving definite integrals.

| Watch this File

File Information

This is a simple script which produces the Legendre-Gauss weights and nodes for computing the definite integral of a continuous function on some interval [a,b]. Users are encouraged to improve and redistribute this script. See also the script Chebyshev-Gauss-Lobatto quadrature (File ID 4461).


This file inspired Sound Power Directivity Analysis.

MATLAB release MATLAB 6.1 (R12.1)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (29)
13 May 2014 Peter


07 May 2014 Siriratchanee Thammasuwan  
13 Mar 2014 Chao

Excellent! Thanks!

20 Dec 2013 erick


11 May 2012 u

very good, thanks

04 Apr 2012 Andrea

very handy, thanks!!

27 Mar 2012 David Bergman

This is a very useful script. Thanks for sharing. I noticed that you are storing a lot of memory for items you don't need. As an example you never use the full Lp, set to zeros(N1,N2). Only the highest order is needed. If I comment out all but the last occurrence of Lp the script generates the same results. You could do the same for L(N1,N2) since you only need 3 values of k at any step in the calculation. Just a thought.

20 Mar 2012 Felipe Pinochet  
06 Nov 2011 Javier Vazquez

Very Good, thanks.

28 Jun 2011 AVIGYAN SINHA  
29 Mar 2011 rahman


01 Nov 2010 David E. Horsley

Brilliant piece of code! I have been using this quite a lot without trouble. I'm always amazed that how quickly Gaussian quadrature converges.

29 Oct 2010 Orkan Umurhan

Thank you very much. The results are good and there are no problems with the accuracy of the approach nor are there any issues with normalization as some people above suggested. I have checked the integration for a wide range of reasonable functions and the numbers check out just right. Thanks!

28 Apr 2010 Tim

very handy tool! thanks!

22 Mar 2009 Christine A.

Excellent! Thanks for sharing. Do you have a reference for your algorithm?

05 Feb 2009 Mohan KV

Neat program. Well done!

05 Feb 2009 Mohan KV  
11 Sep 2008 alex qren  
22 Apr 2008 Xinghui Zhong  
02 Mar 2008 Dawid Z

Works pretty well - thanx

29 Nov 2007 a a  
04 Aug 2007 Phuong Huynh

I would like Tabulated Gauss points

09 Jan 2007 s b

works well in emag apps for tough integrands, fast and simple function

07 Oct 2006 vish j  
26 Jun 2005 kumar gautam  
05 Apr 2005 Nabeel Azar

My QUADG function in the quadrature category contains a subfunction called "gausslegendre" that does an equivalent computation using EIG; it can be used as a separate function if desired.

I don't know about the accuracy of your approach, but if I remember correctly the algorithm I had used is considered quite accurate. It's also very fast.

29 Mar 2005 DEIVEEGAN M  
24 Mar 2005 Tim Warburton

Very nice quadrature routine!.

24 Jan 2005 Dave Farrell

Very handy tool, which for some reason is missing in matlab, like the zeros of the bessel functions.

I did notice the weights are not normalized to 1 however, which seemed to result in an over estimation of the integral.

Good work and thank you

10 May 2004

Found a bug in scaling of weights. Also slight improvement to speed.

Contact us