function [Mass,Rigidity] = matrix_global(Mx,My,Lx,Ly)
  [Ns,Coord,Nt,Vertex,Triangle,Index_vertex] = generate_mesh(Mx,My,Lx,Ly);
  Mass = sparse(Ns,Ns);
  Rigidity = sparse(Ns,Ns);
  for i = 1:Nt
    ind = Index_vertex(i,:);
    [m1,m2] = matrix_elementary(Triangle(:,:,i));
    for j = 1:3
      for l = 1:3
	Mass(ind(j),ind(l)) = Mass(ind(j),ind(l)) + m1(j,l);
        Rigidity(ind(j),ind(l)) = Rigidity(ind(j),ind(l)) + m2(j,l);
      end
    end
  end
end
