function spring_double_ode23 ( )

%*****************************************************************************80
%
%% spring_double_ode23 tests spring_double_ode using ode23().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    26 April 2021
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'spring_double_ode23():\n' );
  fprintf ( 1, '  Use ode23() to solve the double spring ODE.\n' );

  [ m1, m2, k1, k2, t0, y0, tstop ] = spring_double_parameters ( );

  f = @ spring_double_deriv;
  tspan = [ t0, tstop ];

  [ t, y ] = ode23 ( f, tspan, y0 );

  n = size ( t, 1 );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  Number of variable steps = %d\n', n );
%
%  Plot displacements.
%
  figure ( 1 );
  clf ( );
  hold ( 'on' );
    plot ( t, y(:,1), 'r-', 'linewidth', 2 );
    plot ( t, y(:,3), 'b-', 'linewidth', 2 );
    plot ( t, y(:,3) - y(:,1), 'k-', 'linewidth', 2 );
  hold ( 'off' );
  grid ( 'on' );
  xlabel ( '<-- Time -->' );
  ylabel ( '<-- Displacements -->' );
  title ( 'double spring displacements: ode23' );
  legend ( 'u1', 'u2', 'u2-u1' );
  filename = 'spring_double_ode23_plot.png';
  print ( '-dpng', filename );
  fprintf ( 1, '  Graphics saved in "%s"\n', filename );

  return
end

