function [ a, epsilon, gamma, t0, y0, tstop ] = heartbeat_parameters ( a_user, ...
  epsilon_user, gamma_user, t0_user, y0_user, tstop_user )

%*****************************************************************************80
%
%% heartbeat_parameters() returns parameters for heartbeat_ode().
%
%  Discussion:
%
%    If input values are specified, this resets the default parameters.
%    Otherwise, the output will be the current defaults.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    24 March 2022
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real A_USER: the muscle tension.
%
%    real EPSILON_USER: controls the sharpness of the response.
%
%    real GAMMA_USER: the typical fiber length.
%
%    real T0_USER: the initial time.
%
%    real Y0_USER(2): the initial condition at time T0.
%
%    real TSTOP_USER: the final time.
%
%  Output:
%
%    real A: the muscle tension.
%
%    real EPSILON: controls the sharpness of the response.
%
%    real GAMMA: the typical fiber length.
%
%    real T0: the initial time.
%
%    real Y0(2): the initial condition at time T0.
%
%    real TSTOP: the final time.
%
  persistent a_default;
  persistent epsilon_default;
  persistent gamma_default;
  persistent t0_default;
  persistent y0_default;
  persistent tstop_default;
%
%  Initialize defaults.
%
  if ( isempty ( a_default ) )
    a_default = 0.81;
  end

  if ( isempty ( epsilon_default ) )
    epsilon_default = 0.001;
  end

  if ( isempty ( gamma_default ) )
    gamma_default = 0.45;
  end

  if ( isempty ( t0_default ) )
    t0_default = 0.0;
  end

  if ( isempty ( y0_default ) )
    y0_default = [ 1.0, 1.0 ];
  end

  if ( isempty ( tstop_default ) )
    tstop_default = 10.0;
  end
%
%  Update defaults if input was supplied.
%
  if ( 1 <= nargin )
    a_default = a_user;
  end

  if ( 2 <= nargin )
    epsilon_default = epsilon_user;
  end

  if ( 3 <= nargin )
    gamma_default = gamma_user;
  end

  if ( 4 <= nargin )
    t0_default = t0_user;
  end

  if ( 5 <= nargin )
    y0_default = y0_user;
  end

  if ( 6 <= nargin )
    tstop_default = tstop_user;
  end
%
%  Return values.
%
  a = a_default;
  epsilon = epsilon_default;
  gamma = gamma_default;
  t0 = t0_default;
  y0 = y0_default;
  tstop = tstop_default;

  return
end

