function three_weights ( phi, phi_name )

%*****************************************************************************80
%
%% THREE_WEIGHTS displays three radial basis functions.
%
%  Discussion:
%
%    I need to make R0 an input, since it has a huge influence on the plot.
%    
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    24 February 2015
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, @ function PHI ( R ), a handle for the radial basis function.
%
%    Input, string PHI_NAME, the name of the radial basis function.
%
  r8_lo = -5.0;
  r8_hi = +15.0;
  ni = 101;
  xi = linspace ( r8_lo, r8_hi, ni );
%
%  Stick 5 line color choices in a string.
%
  cstring = 'rmkcb';
%
%  Plot the data.
%
  figure ( 1 );
  clf
  hold on
  r0 = 3.0;

  m = 1;
  nd = 3;
  xd = [ 0.0, 5.0, 10.0 ]';

  w = [ 1.0, 0.0, 0.0 ]';
  yi1 = rbf_interp ( m, nd, xd, r0, phi, w, ni, xi );

  w = [ 0.0, 1.0, 0.0 ]';
  yi2 = rbf_interp ( m, nd, xd, r0, phi, w, ni, xi );

  w = [ 0.0, 0.0, 1.0 ]';
  yi3 = rbf_interp ( m, nd, xd, r0, phi, w, ni, xi );

  zi(1:ni,1) = yi1 ./ ( yi1 + yi2 + yi3 );
  zi(1:ni,2) = yi2 ./ ( yi1 + yi2 + yi3 );
  zi(1:ni,3) = yi3 ./ ( yi1 + yi2 + yi3 );

  h = area ( xi, zi );
  set ( h(1), 'FaceColor', [ 1.0, 0.0, 0.0 ] );
  set ( h(2), 'FaceColor', [ 0.0, 1.0, 0.0 ] );
  set ( h(3), 'FaceColor', [ 0.0, 0.0, 1.0 ] );

  xlabel ( '<--- X --->', 'FontSize', 16 );
  ylabel ( '<--- Y --->', 'FontSize', 16 );
  phi_name_tex = s_escape_tex ( phi_name );
  title ( phi_name_tex, 'FontSize', 24 )
  grid on
  hold off
  filename = sprintf ( 'two_weights_%s.png', phi_name );
  print ( '-dpng', filename );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Created plot file "%s".\n', filename );

  return
end
