% GAUSSAB nodes x (Legendre points) and weights w % for Gauss-Legendre quadrature for the interval [a,b] % % Adapted from Trefethen's gauss.m, Spectral Methods in MATLAB, SIAM, 2000 function [x,w] = gaussab(N,a,b) beta = .5./sqrt(1-(2*(1:N-1)).^(-2)); T = diag(beta,1) + diag(beta,-1); [V,D] = eig(T); x = diag(D); [x,i] = sort(x); w = 2*V(1,i).^2; x = a+(b-a)/2*(1+x); % me w = ((b-a)/2)*w; % me