function value = f4 ( x )

%*****************************************************************************80
%
%% f4() evaluates trigonometric interpolation test function #4.
%
%  Discussion:
%
%    F4 is periodic but discontinuous.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    28 August 2019
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real x, the evaluation points.
%
%  Output:
%
%    real value, the function value at x.
%
  value = ( 4.0 * x <= 1.0 ) .* 3.0  ...
        + ( 1.0 <= 4.0 * x ) .* ( 4.0 * x <= 2.0 ) * 5.0 ...
        + ( 2.0 <= 4.0 * x ) .* ( 4.0 * x <= 3.0 ) * 9.0 ...
        + ( 3.0 <= 4.0 * x ) .* 3.0; 

  return
end

