File Exchange

image thumbnail


version 1.0 (1.98 KB) by

Calculates the integral of function f from a to b using ngp Gauss points.

8 Ratings

1 Download


View License


I have found that this is on average +20 times faster than 'Gauss-Legendre' file(4560), and easier to read because it is shorter.

Comments and Ratings (9)

Sorry, my fault. I did a beginner's error, it works. My apologies.


Loginatorist (view profile)

Giuseppe, what are you talking about??

>> f=inline('sin(x)/x');
>> gaussleg(f,-1,1,8)

ans =


>> f=@(x) sin(x)./x;
>> gaussleg(f,-1,1,8)

ans =


>> version

ans = (R2012a)

doesn't work , at least on matlab 2012

sotos ...

Rami Boul

Eric Alvarez

It's slow. The culprit is the use of EIG in the subfunction GAUSS. Moreover, it eats a lot of precious memory.

Sreekanth M.S

This program ROCKS!!
I owe the grade of my project to you! :)
Was getting pissed of by 'quad' function which cannot deal with matrices

Ashesh CB

Definelty a simple and excellent program...

tim cowdry

fast and easy.


Higher tolerance for finding Gauss points.

Increased the speed as per a suggestion.

fixed a typo.

Now checks for NaNs.

Updated to be 4% faster.

MATLAB Release
MATLAB 6.5.1 (R13SP1)

Inspired by: Gauss-Legendre

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

» Watch video