function shallow_water_1d_movie ( h_array, uh_array, x, t )

%*****************************************************************************80
%
%% shallow_water_1d_movie creates graphics files from the solution data.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    01 June 2020
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Cleve Moler,
%    "The Shallow Water Equations",
%    Experiments with MATLAB.
%
%  Input:
%
%    real H_ARRAY(NX,NT), the height for all space and time points.
%
%    real UH_ARRAY(NX,NT), the mass velocity for all space and time points.
%
%    real X(NX), the coordinates of the nodes.
%
%    real T(NT), the time at each timestep.
%
  x_min = min ( x );
  x_max = max ( x );
  
  h_min = 0.0;
  h_max = max ( max ( h_array ) );

  uh_max = max ( max ( uh_array ) );
  uh_min = min ( min ( uh_array ) );

  [ nx, nt ] = size ( uh_array );
%
%  Open the movie.
%
  colormap ( 'jet' );

  moviename = 'h_movie.avi';
  V = VideoWriter ( moviename, 'Motion JPEG AVI' );
  open ( V );
%
%  For each time step, plot H.
%
  for it = 1 : nt

    clf ( );
    h1 = axes ( );
    axis ( [ x_min, x_max, h_min, h_max ] );
    axis ( 'manual' );
    hold ( 'on' );
    area ( h1, x, h_array(:,it) );
    hold ( 'off' );
%
%  Take a snapshot of the current image, and save it to a JPEG file.
%
    frame = getframe ( );
    writeVideo ( V, frame );

  end
  close ( V );
  fprintf ( 1, '  Movie saved as "%s"\n', moviename );
%
%  Open the movie.
%
  colormap ( 'jet' );

  moviename = 'uh_movie.avi';
  V = VideoWriter ( moviename, 'Motion JPEG AVI' );
  V.FrameRate = 30;
  open ( V );
%
%  For each time step, plot UH.
%
  for it = 1 : nt

    clf ( );
    h2 = axes ( );
    axis ( [ x_min, x_max, uh_min, uh_max ] );
    axis ( 'manual' );
    hold ( 'on' );
    area ( h2, x, uh_array(:,it), 0.0, 'FaceColor', [ 0.6, 0.1, 0.1 ] );
    hold ( 'off' );
%
%  Add this image to the movie.
%
    frame = getframe ( );
    writeVideo ( V, frame );

  end

  close ( V );
  fprintf ( 1, '  Movie saved as "%s"\n', moviename );
%
%  Terminate.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'shallow_water_1d_frames:\n' );
  fprintf ( 1, '  Normal end of execution.\n' );

  return
end

