%A badly designed script to compute the trepezodial rule calculation 
%for x and y, assuing the entires in x are uniformly spaced.
%
n=length(x);
dx=x(2)-x(1);
%
v=0;
for i=1:n
	if i==1
		v=y(i);
	elseif i==n
		v=v+y(i);
	else
		v=v+2*y(i);
	end
end
dx*v/2