function [Exxlyr,wg_avg] = CalcYoungMod_2(Ncells,l,h,Emxx,Egxx,tg,mu)
    %calcula modulo elastico en x y y
  
    %porcentaje de grafeno en la celda
    sigma = 0.05;
    %mu = 0.70;
    for i = 1 : Ncells
      for j = 1 : Ncells
        sed = rand(1);
        wg(i,j) = erfinv(2*sed-1)*sigma*sqrt(2)+mu;
      end
    end
    
    agrafcell = l*h*wg;          %relacion 1:1
    lg = sqrt(agrafcell);
    hg = lg;
    agraf = sum(sum(agrafcell));
    arve = l*h*Ncells^2;
    wg_avg = agraf/arve;
    Klayer = 0.0;
    
    for j = 1 : Ncells
      
        Kxxrow = 0.0;
        
        for i = 1 : Ncells
            lamb1 = (h-hg(i,j))/(l-lg(i,j));
            lamb2 = (h-hg(i,j))/(2*lg(i,j));
            lamb3 = 2*hg(i,j)/(l-lg(i,j));
            lamb4 = hg(i,j)/lg(i,j);
            Kxxcell = 2*Emxx*tg*lamb1*lamb2/(lamb1+2*lamb2) + Emxx*Egxx*tg*lamb3*lamb4/(Emxx*lamb3+2*Egxx*lamb4); %para las 9 celdas
            Kxxrow = Kxxrow + 1/Kxxcell;
        end
        
        Kxxrow = 1/Kxxrow;
        Klayer = Klayer + Kxxrow;
        
    end
    
    Exxlyr = Klayer*1/tg;
    
    Exxlyr_avg = mean(mean(Exxlyr));
      
 return