function y = velocity ( x )

%
%  Integral from 0 to 24 is 345.22
%
%  This function looks like a formula, but it's just the linear
%  interpolant of data.
%
  ndata = 20;

  xdata = [ ...
    0.0,  1.0,  2.0,  3.0,  4.0, ...
    5.0,  6.0,  7.0,  8.0, 12.0, ...
   13.0, 14.0, 17.0, 18.0, 19.0, ...
   20.0, 21.0, 22.0, 23.0, 24.0 ];

  ydata = [ ...
     0.00,  0.45,  1.79,  4.02,  7.15, ...
    11.18, 16.09, 21.90, 29.05, 29.05, ...
    22.42, 17.90, 17.90, 14.34, 11.01, ...
     8.90,  6.54,  2.03,  0.55,  0.00 ];
  
  n = length ( x );
  y = zeros ( n );

  for j = 1 : n

    if ( xdata(1) < x(j) && x(j) < xdata(ndata) )
      for k = 1 : ndata - 1
        if ( xdata(k) <= x(j) && x(j) <= xdata(k+1) )
          w1 = ( xdata(k+1) - x(j) ) / ( xdata(k+1) - xdata(k) );
          w2 = ( x(j) - xdata(k) ) / ( xdata(k+1) - xdata(k) );
          y(j) = w1 * ydata(k) + w2 * ydata(k+1);
          break
        end
      end
    end
  end

  return
end

