
function LL = st_func(a,dat)

% This is a Space-Time L function.
% It requires AREA, a , to be given along with 
% a data file containing loacations and times: dat(i) (Xi, Yi, Ti) 

[m,n] = size(dat); %dat = data matrix

loc =  dat(:,1:2) ;
tim =  dat(:,3)   ;


i = 1;

DT = zeros(m*(m-1)/2,2) ;

% Start procedure.

i = 1 ;

k = 1 ;  %counter for DT.

Dmax = 0 ;
Tmax = 0 ;

while i < m
   
   j = i + 1 ;
   
   while j <= m
      
      DT(k,1) = norm(loc(i,:) - loc(j,:));
      
      DT(k,2) = abs(tim(i) - tim(j));
           
      
      if DT(k,1) > Dmax 
         
         Dmax = DT(k,1);
         
      end
      
      if DT(k,2) > Tmax 
         
         Tmax = DT(k,2);
         
      end
      
      j = j + 1 ;
      
      k = k + 1 ;
      
   end
   
   i = i + 1 ;
   
end

LL = zeros(2,2) ;
