function drug_dosage_plots ( )

%*****************************************************************************80
%
%% DRUG_DOSAGE_PLOTS models the variation in blood levels of a medicinal drug.
%
%  Discussion:
%
%    Drug levels in the blood, for certain drugs, can be modeled by a pair of
%    coupled first-order linear differential equations.
%
%    The concentration level must reach 800 mg / liter to be medicinally
%    effective but becomes toxic at 1000 mg / liter.
%
%    It is desired to plot the concentration level, as well as two horizontal
%    lines representing the medicinal and toxic levels.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    19 July 2018
%
%  Reference:
%
%    Soraya Dhillon, Andrzej Kostrzewski,
%    Clinical Pharmacokinetics,
%    Pharamceutical Press, 2006,
%    ISBN: 978-0-85369-571-4.
%
  timestamp ( );
  fprintf ( 1, '\n' );
  fprintf ( 1, 'DRUG_DOSAGE_PLOTS:\n' );
  fprintf ( 1, '  MATLAB/Octave version %s:\n', version ( ) );
  fprintf ( 1, '  Plot the variation over time of the concentration\n' );
  fprintf ( 1, '  of a medicinal drug in the bloodstream.\n' );
%
%  Read plasma level from a file.
%
  filename = 'drug_dosage_data.txt';
  data = load ( filename );
  t = data(:,1);
  plasma_concentration = data(:,2);
  N = length ( t );
%   
%  Plot the concentration levels, the medicinal, and danger levels.
%
  clf ( );
  hold ( 'on' );

    plot ( t, plasma_concentration, 'b-', 'linewidth', 2 );

    times = [ t(1), t(N) ];
    m_level = [ 800, 800 ];
    plot ( times, m_level, 'r-', 'linewidth', 4 );

    t_level = [ 1000, 1000 ];
    plot ( times, t_level, 'g-', 'linewidth', 4 );

  hold ( 'off' );

  legend ( 'Plasma Concentration',  'Medicinal Level', 'Toxic Level' );

  grid ( 'on' );
  title ( 'Drug level variation over time.', 'Fontsize', 24 );
  xlabel ( '<-- Hours -->', 'Fontsize', 16 );
  ylabel ( '<-- Concentration (mg/l) -->', 'Fontsize', 16 );
  ylim ( [ 0.0, 1100.0] );

  pause ( 5 )
%
%  Save graphics to a file.
%
  filename = 'drug_dosage_plots.png';
  print ( '-dpng', filename );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Graphics file saved as "%s"\n', filename );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'DRUG_DOSAGE_PLOTS:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );
  timestamp ( );

  return
end
