View License

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

» Watch video

Highlights from
Legendre Laguerre and Hermite - Gauss Quadrature

4.6 | 8 ratings Rate this file 38 Downloads (last 30 days) File Size: 3.25 KB File ID: #26737 Version: 1.2

Legendre Laguerre and Hermite - Gauss Quadrature



19 Feb 2010 (Updated )

Nodes and weights for Legendre Laguerre and Hermite - Gauss Quadrature

| Watch this File

File Information

This .zip file contains 3 mfiles for computing the nodes and weights for Legendre Laguerre and Hermite - Gauss Quadrature of any order n.

Contrary to most of the files in use, the included files are all based on a symmetrical companion matrix, the eigenvalues of which are always real and correspond to the roots of the respective polynomials.

Hence, there is a 100% certainty of avoiding complex roots at high orders. It is known that the latter issue often causes huge numerical troubles.


This file inspired Nodal Dg, Correction Procedure Via Reconstruction (Cpr), and Modal Dg.

MATLAB release MATLAB 7.0.4 (R14SP2)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (13)
10 Jan 2017 Jennhong Tang

very useful!

24 Sep 2016 Leo Lee

Can I ask a question? Can I use this for multivariate normal case?

Comment only
24 Apr 2016 brabbit

01 Sep 2015 Osvaldo

Very clever and precise.

04 Oct 2013 Manuel A. Diaz

Is it me or these routines are not working correctly in Matlab 2013b?
PS. I have been using them since 2010.

Comment only
04 Oct 2013 Manuel A. Diaz

29 Jan 2013 Giuseppe Cascarino

Simple and fast.

06 Jan 2013 afu2007 ??


01 May 2012 David Holdaway

I added this on the end to refine the eigenvalues via newtons method

if mod(n,2)==1

success = false;
for its=1:50 %maxit=50, usually will take 2
p1 = pi^(-1/4);
for j=1:n %make hermite we need
pp = sqrt(2*n).*p2;
if all(abs(z-z1)< 20*eps)
success = true;
if ~success
warning('failed to converge to desired accuracy')
w(x>=0) = 2./pp.^2;
w(x<=0) = flipud(w(x>=0));
x(x>=0) = z;
x(x<=0) = -flipud(z);

Comment only
01 May 2012 David Holdaway

Oh and I forgot to add this required you insist x = 0 is the middle value for odd via
if mod(n,2)==1

Comment only
30 Apr 2012 David Holdaway

Very nice submission, simple and fast

20 Oct 2010 Marios Karaoulis

One addition I did is this

% Linear map from[-1,1] to [a,b]

a and b are user provided, and I think now that you can shift from [1 1] to [a b]

Comment only
20 Oct 2010 Marios Karaoulis

Very useful program.

How can I calculate the GaussLegendre in the [0 1] space?

19 Feb 2010 1.1

No updates were made. Only the description was changed: it should read "the eigenvalues of the companion matrix" instead of "the roots of the companion matrix". Obviously, a matrix has no roots.

21 Feb 2010 1.2

Some minor changes to the code's comments.

Contact us