function interval_width_test ( )

%*****************************************************************************80
%
%% interval_width_test() tests pwc_lines_1d().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    21 April 2021
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'interval_width_test()\n' );
  fprintf ( 1, '  pwc_lines_1d() displays a piecewise\n' );
  fprintf ( 1, '  constant function of a 1D argument as a broken line.\n' ); 
%
%  N is the number of intervals.
%
  n = 10;
%
%  Select N-1 internal nodes.
%
  x = rand ( n - 1, 1 );
%
%  Add nodes at 0 and 1, then shift to [5,10].
%
  x = 5.0 + 5.0 * [ 0.0; x; 1.0 ];
%
%  Sort the nodes.
%
  x = sort ( x );
%
%  Let Y be the width of each interval.
%
  y = x(2:n+1) - x(1:n);
%
%  Get the sequence of points that can be used to draw the function.
%
  [ xp, yp ] = pwc_lines_1d ( x, y );
%
%  Call MATLAB to plot it.
%
  plot ( xp, yp, 'b-o', 'Linewidth', 3 );
  grid ( 'on' );
  xlabel ( '<--- X --->' );
  ylabel ( '<--- Width --->' );
  title ( 'Interval width plot.' );

  filename = 'interval_width_test.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Saved graphics as "%s"\n', filename );

  return
end

