format long a = 0; b = 1; n = 64; h = (b-a)/n; x = a : h : b; f = exp(-x); w = ones(1,n+1); w(2:2:n) = 4; w(3:2:n-1) = 2; s = w*f'*h/3