function Ai = ParamDH( q,L )

%-- Vector comprimentos: L = [l0 l1 l2 l3 l4 lt_L lt_W lt_H];
 l0 = L(1); l1 = L(2);
 lh_l = L(5); lh_w = L(4); lh_h = L(3);
 lt_l = L(6); lt_w = L(7); lt_h = L(8);

% %-- Parametros de Denavit-Hartenberg -------------------------------------------------
  DH = [ q(1)       l1         0            -pi/2
         q(2)-pi/2  0          0            -pi/2    
         0          0          lh_w          0
        -pi/2       lh_h       0             0   ];        
 
% %-- Matrizes de transformaçao Ai -----------------------------------------------------
  Ai(:,:,1) = [ 1  0  0  0
                0  1  0  0
                0  0  1  l0+lt_h 
                0  0  0  1       ];
 for i=1:size(DH,1),
      Ai(:,:,i+1) = [ cos(DH(i,1)) -sin(DH(i,1))*cos(DH(i,4))  sin(DH(i,1))*sin(DH(i,4))  DH(i,3)*cos(DH(i,1))
                      sin(DH(i,1))  cos(DH(i,1))*cos(DH(i,4)) -cos(DH(i,1))*sin(DH(i,4))  DH(i,3)*sin(DH(i,1))
                      0                          sin(DH(i,4))               cos(DH(i,4))  DH(i,2)
                      0             0                          0                          1  ]; 
 end   
%-------------------------------------------------------------------------------end
