%
%
function [X,U] = LagenExactSquare(N,TIME,SPEEDA)
  % Calculate mesh size DX
  DX = 2.0/N ;
  X  = [-1+DX/2-TIME*SPEEDA:DX:1-DX/2-TIME*SPEEDA] ;
  % put the solution in [-1..1]
  U = zeros(1,N) ;
  for i=1:N
    while ( X(i) < -1 )
      X(i) = X(i) + 2 ;
    end ;
    while ( X(i) >  1 )
      X(i) = X(i) - 2 ;
    end ;
    if X(i) >= -1/3.0 && X(i) <= 1/3.0 
      U(i) = 1 ;
    end
  end
  % smooth profile
  X = [-1+DX/2:DX:1-DX/2] ;
end
