%DECK DSS018
      function [ux]=dss018(xl,xu,n,u,v)
%...
%...  FUNCTION DSS018 IS AN APPLICATION OF THIRD-ORDER DIRECTIONAL
%...  DIFFERENCING IN THE NUMERICAL METHOD OF LINES.  IT IS INTENDED
%...  SPECIFICALLY FOR THE ANALYSIS OF CONVECTIVE SYSTEMS MODELLED BY
%...  FIRST-ORDER HYPERBOLIC PARTIAL DIFFERENTIAL EQUATIONS AS DIS-
%...  CUSSED IN FUNCTION DSS012.  THE COEFFICIENTS OF THE FINITE
%...  DIFFERENCE APPROXIMATIONS USED HEREIN ARE TAKEN FROM BICKLEY, W.
%...  G., FORMULAE FOR NUMERICAL DIFFERENTIATION, THE MATHEMATICAL
%...  GAZETTE, PP. 19-27, 1941, N = 3, M = 1, P = 0, 1, 2, 3.  THE
%...  IMPLEMENTATION IS THE **FOUR-POINT BIASED UPWIND FORMULA** OF
%...  M. B. CARVER AND H. W. HINDS, THE METHOD OF LINES AND THE
%...  ADVECTION EQUATION, SIMULATION, VOL. 31, NO. 2, PP. 59-69,
%...  AUGUST, 1978
%...
%...  COMPUTE THE COMMON FACTOR FOR EACH FINITE DIFFERENCE APPROXIMATION
%...  CONTAINING THE SPATIAL INCREMENT, THEN SELECT THE FINITE DIFFER-
%...  ENCE APPROXIMATION DEPENDING ON THE SIGN OF V (SIXTH ARGUMENT).
      dx=(xu-xl)/(n-1);
      r3fdx=1./(6.*dx);
%...
%...     (1)  FINITE DIFFERENCE APPROXIMATION FOR POSITIVE V
      if v > 0
      ux(  1)=r3fdx*...
      ( -11.*u(  1) +18.*u(  2)  -9.*u(  3)  +2.*u(  4));
      ux(  2)=r3fdx*...
      (  -2.*u(  1)  -3.*u(  2)  +6.*u(  3)  -1.*u(  4));
      nm1=n-1;
      for i=3:nm1
         ux(  i)=r3fdx*...
         (  +1.*u(i-2)  -6.*u(i-1)  +3.*u(  i)  +2.*u(i+1));
      end
      ux(  n)=r3fdx*...
      (  -2.*u(n-3)  +9.*u(n-2) -18.*u(n-1) +11.*u(  n));
      end
%...
%...     (2)  FINITE DIFFERENCE APPROXIMATION FOR NEGATIVE V
      if v < 0
      ux(  1)=r3fdx*...
      ( -11.*u(  1) +18.*u(  2)  -9.*u(  3)  +2.*u(  4));
      nm2=n-2;
      for i=2:nm2
      ux(  i)=r3fdx*...
         (  -2.*u(i-1)  -3.*u(  i)  +6.*u(i+1)  -1.*u(i+2));
      end
      ux(n-1)=r3fdx*...
      (  +1.*u(n-3)  -6.*u(n-2)  +3.*u(n-1)  +2.*u(  n));
      ux(  n)=r3fdx*...
      (  -2.*u(n-3)  +9.*u(n-2) -18.*u(n-1) +11.*u(  n));
      end
