function [midvals] = mid(vector);
% [midvals] = mid(vector);
% averages in the vertical if it's a matrix
% returns the midpoints suitable for plotting diff(x) against

[rows, cols] = size(vector);
if (rows == 1)
   midvals=(vector(1:end-1)+vector(2:end))/2;
else
   midvals=(vector(1:end-1,:)+vector(2:end,:))/2;
end




