function integral = arbitary_spacing( x,f )
%arbitray_spacing uses trap rule to calculate integrals without
%restrictions on where integrand is evaluated
%   x=array of points where integrand has been evaluated
%   f=value of integrand at points in the x array
n=length(x);
integral=0;
for i=1:n-1
    integral=integral+(f(i+1)+f(i))*(x(i+1)-x(i));
end
integral=integral/2;
end