%A better script to compute the trapezodial rule calculation for x and y.
%
n=length(x);
sum(diff(x).*(y(2:n)+y(1:n-1)))/2