function boundary_locus2 ( t, f, label, filename )

%*****************************************************************************80
%
%% boundary_locus2() plots the region of absolute stability.
%
%  Discussion:
%
%    An ODE solution method is analyzed by applying it to the problem
%      y' = lambda * y
%
%    A stepsize h is assumed.  The method is then transformed into an 
%    equation of the form
%      rho(z) = h * lambda * sigma(z)
%    or 
%      h * lambda = rho(z) / sigma(z)
%
%    We now consider 
%      f(z) = rho(z) / sigma(z)
%    and trace the curve f(z) for those complex z with unit norm,
%    which marks the boundary of the region of absolute stability.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    27 September 2022
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real t(*): a vector containing the range of angles to be used.
%    The z values will be generated as exp(i*t).
%    In most cases, t = linspace ( 0.0, 2.0 * pi, 101 ) will do.
%
%    function handle f: evaluates the ratio rho(z)/sigma(z).
%
%    string label: a title to be used in the plot.
%
%    string filename: the name of the png graphics file to be created.
%

%
%  Evaluate f(z) for z's of unit norm.
%
  z = exp ( i * t );
  fz = f(z);
%
%  As a help in judging which side of the boundary is the stability region,
%  include a second line for z's of norm 0.9.
%
  z2 = 0.9 * exp ( i * t );
  fz2 = f(z2);
%
%  Get the range of the data.
%
  xmin = min ( min ( real ( fz ) ), min ( real ( fz2 ) ) );
  xmax = max ( max ( real ( fz ) ), max ( real ( fz2 ) ) );
  ymin = min ( min ( imag ( fz ) ), min ( imag ( fz2 ) ) );
  ymax = max ( max ( imag ( fz ) ), max ( imag ( fz2 ) ) );
%
%  Display the plot.
%
  clf ( );
  hold ( 'on' );
  plot ( real ( fz ), imag ( fz ), 'r-', 'linewidth', 3 );
  plot ( real ( fz2 ), imag ( fz2 ), 'm-', 'linewidth', 3 );
  plot ( [ 0.0, 0.0 ], [ymin,ymax], 'k:', 'linewidth', 3 );
  plot ( [xmin,xmax], [0.0,0.0], 'k:', 'linewidth', 3 );
  hold ( 'off' );
  grid ( 'on' );
  axis ( 'equal' );
  xlabel ( '<-- real(z) -->' );
  ylabel ( '<-- imag(z) -->' );
  title ( label );
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );

  return
end

