function u = triangle ( x )

%*****************************************************************************80
%
%% triangle evaluates a traveling wave that satisfies the advection equation.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    29 May 2020
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real x: the spatial location.
%
%  Output:
%
%    real u: the "height" of the wave.
%
  n = length ( x );
  u(1:n) = 0.1;
  i = find ( 0.4 <= x & x <= 0.8 );
  u(i) = ( x(i) - 0.4 ) / 0.4;
  j = find ( 0.8 <= x & x <= 1.2 );
  u(j) = ( 1.2 - x(j) ) / 0.4;

  return
end
