function GradN = shpGradNmatrix2D(r,s)
% Evaluates derivatives of shape functions (in parametric coordinates).
% Input arguments:
%  r,s:  parametric coordinate values
% Output arguments:
%  GradN: Shape function gradient matrix evaluated at given position

 include_gblrefs;

 GradN = zeros(2,nen);

 if(element_type == TRIA3)         % linear triangle element
 % 
 %                           s
 %                           ^
 %                           |
 %     
 %                         3 +
 %                           |\
 %                           | \
 %                           |  \
 %                           |   \ TRIA3
 %                           |    \
 %                         1 +-----+ 2  ----> r
 %
  GradN(1,1) = -1.0;
  GradN(2,1) = -1.0;
  GradN(1,2) =  1.0;
  GradN(2,2) =  0.0;
  GradN(1,3) =  0.0;
  GradN(2,3) =  1.0;

 elseif(element_type == QUAD4)     % bilinear quadrilateral element
 % 
 %                         4 +---------------+ 3
 %                           |       s       |
 %                           |       ^       |
 %                           |       |       |
 %                           |       ----> r |
 %                           |               |
 %                           |     QUAD4     |
 %                           |               |
 %                         1 +---------------+ 2
 %
 %
  %%% COMPLETE HERE 06 %%%

 elseif(element_type == TRIA6)     % quadratic triangle element
 % 
 %                           s
 %                           ^
 %                           |
 %     
 %                         3 +
 %                           |\
 %                           | \
 %                         6 +  + 5
 %                           |   \ TRIA6
 %                           |    \
 %                         1 +--+--+ 2  ----> r
 %                              4
 %
  %%% COMPLETE HERE 07 %%%

 elseif(element_type == QUAD8)     % serendipity quadratic quadrilateral element
 % 
 %                                   7
 %                         4 +-------+-------+ 3
 %                           |       s       |
 %                           |       ^       |
 %                           |       |       |
 %                         8 +       ----> r + 6
 %                           |               |
 %                           |     QUAD8     |
 %                           |               |
 %                         1 +-------+-------+ 2
 %                                   5
 %
  %%% COMPLETE HERE 08 %%%

 end

end
