format long n=64; a=0; b=1; 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