
     function s  = SF(D,node,u)
%------------------------------------------------------------ 
%    Shape Functions
%       D = derivative
%         = 0 function itself
%         = 1 first derivative of function
%    node = nodal point number (1 or 2)
%       u = local coordinate
%------------------------------------------------------------
       if D == 0   %  Calculate shape function
	  if node == 1
	        s = (0.5 - 0.5*u);
	  elseif node == 2
	        s = (0.5 + 0.5*u);
          else
                error('Error #1 in SF function') 
          end

       elseif D == 1   %  Calculate shape function
	  if node == 1
	        s = -0.5;
	  elseif node == 2
	        s = +0.5;
          else
                error('Error #2 in SF function');
          end
       else
          error('Error #3 in SF function')
       end 

