% % Quadrature points and weights for the trapezoid rule. % function [x,w] = trap(N) h = 1/(N-1); x = 0:h:1; w = h*ones(size(x)); w(1) = h/2; w(N) = h/2;