function shepard_interp_1d_test02 ( prob, p )

%*****************************************************************************80
%
%% SHEPARD_INTERP_1D_TEST02 tests SHEPARD_BASIS_1D.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    07 August 2012
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'SHEPARD_INTERP_1D_TEST02:\n' );
  fprintf ( 1, '  Plot the Shepard basis functions for TEST_INTERP problem #%d\n', prob );
  fprintf ( 1, '  using Shepard interpolation with P = %g\n', p );

  dim_num = p00_dim_num ( prob );

  nd = p00_data_num ( prob );
  fprintf ( 1, '  Number of data points = %d\n', nd );

  xy = p00_data ( prob, dim_num, nd );
  
  xd = reshape ( xy(1,1:nd), nd, 1 );
  r8vec_print ( nd, xd, '  X Data Locations:' );

  figure ( 1 );
  clf
  ni = 181;
  xmin = min ( xd );
  xmax = max ( xd );
  xi = r8vec_linspace ( ni, xmin, xmax );

  hold on

  bk = shepard_basis_1d ( nd, xd, p, ni, xi );

  for j = 1 : nd
    plot ( xi, bk(:,j), 'r-', 'Linewidth', 4 );
  end
  xlabel ( '<--- X --->' );
  ylabel ( '<--- Y --->' );
  title ( sprintf ( 'Interpolant for problem %d using Shepard basis with P = %g', prob, p ) )
  grid on
  hold off

  filename = sprintf ( 'p%02d_%g_basis.png', prob, p );
  print ( '-dpng', filename );
  fprintf ( 1, '  Created plot file "%s".\n', filename );

  return
end
