function PSI = skeleton4 ( X, Y, U, V )

%*****************************************************************************80
%
%% skeleton4 computes a stream function psi from a velocity field (u,v).
%
%  Discussion:
%
%    We assume the x and y grid spacings are each uniform.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    13 June 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real X(nr,nc), Y(nc,nc): the node coordinates.
%
%    real U(nr,nc), V(nr,nc): horizontal and vertical velocities.
%
%  Output:
%
%    real PSI(nr,nc): the stream function.
%
  [ nr, nc ] = size ( U );

  dx = X(1,2) - X(1,1);
  dy = Y(1,1) - Y(2,1);
  
  PSI = zeros ( nr, nc );

  for r = nr : -1 : 1

    if ( r == nr )
      PSI(r,1) = 0.0;
    else
      PSI(r,1) = PSI(r+1,1) + ?;
    end

    for c = 2 : nc
      PSI(r,c) = PSI(r,c-1) - ?;
    end

  end

  figure ( );
  contourf ( X, Y, PSI );
  xlabel ( '<-- x -->' );
  ylabel ( '<-- y -->' );
  title ( 'Stream function \psi(x,y)' );

  return
end
