function ellipse_distance_histogram ( n, a, b )

%*****************************************************************************80
%
%% ellipse_distance_histogram() histograms ellipse distance statistics.
%
%  Discussion:
%
%    The ellipse will be assumed to have the form:
%
%      (x/a)^2 + (y/b)^2 = 1;
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    20 March 2021
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    integer N, the number of samples to use.
%
%    real A, B, the ellipse parameters.
%
  p = ellipse_sample ( n, a, b );
  q = ellipse_sample ( n, a, b );

  t = zeros ( n, 1 );
  for i = 1 : n
    t(i) = norm ( p(i,:) - q(i,:) );
  end

  tmax = max ( abs ( a ), abs ( b ) );
  bins = 20;
  hist ( t, bins );
  grid ( 'on' );
  xlabel ( '<-- Distance -->' );
  ylabel ( '<-- Frequency -->' );
  label = sprintf ( 'Pairwise point distances on ellipse with a = %g, b = %g\n', a, b );
  title ( label );

  return
end
