function K = ComputeDiffussionMatrix(X,T)

ngaus = 2; 
zgp = [-sqrt(3)/3; sqrt(3)/3];
wgp= [1 1];
N = [(1-zgp)/2 (1+zgp)/2];
Nxi = [-1/2 1/2; -1/2 1/2];

npt = size(X,1); 
[numel,nen] = size(T); 
K = spalloc(npt,npt,3*npt); 
for ielem = 1:numel
    Te = T(ielem,:); 
    Xe = X(Te,:); 
    
    Ke = zeros(nen);    
    for ig=1:ngaus
        N_ig   = N(ig,:);
        Nxi_ig = Nxi(ig,:);
        %Jacobia 
        J = Nxi_ig*Xe; 
        % Derivadas de las funciones de forma respecto a (x,y)
        Nx_ig = J\Nxi_ig; 
        %diferencial de volum
        dvolu = wgp(ig)*det(J);
        Ke = Ke + Nx_ig'*Nx_ig*dvolu; 
    end
    K(Te,Te) = K(Te,Te) + Ke;
end
