function artery_ode45 ( tspan )

%*****************************************************************************80
%
%% artery_ode45() solves the artery PDE using ode45().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    21 December 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real TSPAN = [ T0, TMAX ], the initial and final times.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'artery_ode45():\n' );
  fprintf ( 1, '  Use ode45() to solve a PDE with the method of lines\n' );
  fprintf ( 1, '  solving for for the displacement\n' );
  fprintf ( 1, '  of arterial walls under pressure.\n' );

  [ a, alpha, b, beta, dp, gamma, l, nx, omega, t0, w0, x ] = artery_parameters ( );

  [ t, w ] = ode45 ( @artery_deriv, tspan, w0 );

  nt = size ( t, 1 );
  fprintf ( 1, '  Number of time steps is %d\n', nt );
%
%  Plot the solution at the last time.
%
  figure ( 1 );
  clf ( );
  hold ( 'on' );
  plot ( x, w(nt,1:nx), 'g', 'LineWidth', 2 );
  plot ( x, w(nt,nx+1:2*nx), 'r', 'LineWidth', 2 );
  hold ( 'off' );
  grid ( 'on' );
  xlabel ( '<-- X -->' );
  ylabel ( 'displacement/velocity' );
  title ( 'artery ode45(): spatial plot at final time' );
  legend ( 'displacement', 'velocity' );
  filename = 'artery_ode45_plot.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
  close ( 1 )
%
%  Plot the variation in Y(L/2) over time.
%  Compare to plot in Quarteroni reference.
%
  nh = floor ( (nx+1)/2 );
  figure ( 2 );
  clf ( );
  hold ( 'on' );
  plot ( t, w(:,nh), 'g', 'LineWidth', 2 );
  hold ( 'off' );
  grid ( 'on' );
  xlabel ( '<-- T -->' );
  ylabel ( 'midpoint displacement' );
  title ( 'artery ode45(): midpoint displacement time plot' );
  filename = 'artery_ode45_midpoint_displacement.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
  close ( 2 )
%
%  Plot the variation in Y'(L/2) over time.
%
  nh = floor ( (nx+1)/2 );
  figure ( 3 );
  clf ( );
  hold ( 'on' );
  plot ( t, w(:,nx+nh), 'r', 'LineWidth', 2 );
  hold ( 'off' );
  grid ( 'on' );
  xlabel ( '<-- T -->' );
  ylabel ( 'midpoint velocity' );
  title ( 'artery ode45(): midpoint velocity time plot' );
  filename = 'artery_ode45_midpoint_velocity.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved as "%s"\n', filename );
  close ( 3 )

  return
end

