function [cof1,cof2]=least(x,dt)
% The function LEAST returns the coefficients found by least square method.
% Only 1st column of 2-D input data x(:,1) is processed.
%
% Calling sequence-
% [cof1,cof2]=least(x,dt)
%
% Input-
% x - 2-D data x(m,n)
% dt - the true delta t
% Output-
% cof1,cof2 - numbers representing the coefficients
%
% Used by-
% ACC2DIS
%----- Get dimensions
[m,n]=size(x) ;
%----- Calculate the coefficients
sx=sum(x(:,1)) ;
sxx=0. ;
for jj=1:m ;
sxx=sxx+jj*x(jj,1) ;
end
cof1=(2*(2*m+1)*sx-6*sxx)/(m*(m-1)) ;
cof2=(12*sxx-6*(m+1)*sx)/(dt*m*(m-1)*(m+1)) ;