function [x] = centremass1D( m,points )
%computes the position of the centre of mass of particles distributed in 1D 
%m: vector of masses
%points: vector of distances 

%----------
%example
%>>m=[5,3,9,1];
%>>points=[-1,1,4,5];
%>>x=centremass1D(m,points)
%x =
%    2.1667
%---------

sw=length(m);
spoints=length(points);

if sw~=spoints
    x=NaN;
    disp('input error')
    return
end


x=sum(m.*points)/sum(m);


end

