clear format long n = 64; h = 1/n; x = 0:h:1; f = e.^(-x); w = ones(1,n+1); w(2:2:n) = 4; w(3:2:n-1) = 2; s = (h/3)*w*f'