disp('Running MATLAB script file interp1t.m') ;
%
%    FOR DEVELOPMENT AND TESTING OF MATLAB FUNCTION interp1s,
%    Linear interpolation, with (constant) extrapolation beyond ends


itest = 2 ;     %  1,2


if itest == 1 ;   %  Simple visual check 
  indat = [[.2, 1];...
           [.3, 2];...
           [.5, 1];...
           [.8, 3];...
           [.85, 2]];
  xgrid = linspace(0,1,101)' ;
  out = interp1s(indat(:,1),indat(:,2),xgrid) ;
  plot(xgrid,out) ;
      hold on ;
        plot(indat(:,1),indat(:,2),'or') ;
      hold off ;
   
elseif itest == 2 ;   %  random data check 
  xdat = sort(rand(20,1)) ;
  ydat = randn(20,1) ;
  xgrid = linspace(-.5,1.5,201)' ;
  out = interp1s(xdat,ydat,xgrid) ;
  plot(xgrid,out) ;
      hold on ;
        plot(xdat,ydat,'or') ;
      hold off ;

end ;


