Computing Integral with Gauss-Chebyshev Quadrature in MATLAB

Click For Summary
SUMMARY

The discussion focuses on computing integrals using Gauss-Chebyshev quadrature in MATLAB. A specific MATLAB function, chebquad, is provided for evaluating the integral of a function over the interval from -1 to 1, utilizing Chebyshev nodes and weights. The user seeks verification of the function's correctness and inquires about adapting the method to compute a different integral from 1 to 2 with a specified accuracy of 10^-8. Key resources for understanding the quadrature method are linked, including a formula reference and MATLAB tutorial.

PREREQUISITES
  • Understanding of Gauss-Chebyshev quadrature
  • Familiarity with MATLAB programming
  • Knowledge of numerical integration techniques
  • Basic understanding of function approximation
NEXT STEPS
  • Review the MATLAB documentation on numerical integration functions
  • Learn about error analysis in numerical methods
  • Explore the implementation of adaptive quadrature methods in MATLAB
  • Investigate the use of Chebyshev polynomials in approximation theory
USEFUL FOR

Mathematicians, engineers, and researchers involved in numerical analysis, particularly those interested in implementing quadrature methods for integral computation in MATLAB.

Fidelio
Messages
3
Reaction score
0
Hello, anyone knows where y can find a program to compute the integral

∫ ( from -1 to 1) f(x)/ √(1-x^2) using the Gauss-Chebyshev quadrature, on matlab?

Thanks!
 
Physics news on Phys.org
thanks so much AlephZero,

Could you check If it is correct ?

function int = chebquad(funct,accuracy)
f = inline(funct);
old_int = inf;
for n=1:1000

x = cos(((2*(1:n) - 1)/(2*n))*pi);
w = pi/n;
fx = f(x);
int = sum(w.*fx);
if abs(int_old-int) < abs(tol*int),
converge='y';
break;
end
old_int = int;
end

And now If I want to compute this integral \int_1^2 dx \frac { e^{2x} }{ ( (2-x) ( (1-x))^{1/2} } with an accuracy 10^-8 what could I do?
 

Similar threads

Replies
6
Views
4K
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 32 ·
2
Replies
32
Views
4K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K