clear;clc; close all
Emxx = 3.5e9                    %Pa
Egxx = 3.5e9                   %Pa
tg = 1e-9                       %m espesor del rve
lrve = 1000e-9                  %m longitud RVE
hrve = lrve                     %m altura RVE
Ncells = 10                     %numero de celdas que conforman el RVE
l = lrve/Ncells                 %m logitud de celda que rodea a grafeno l*Ncells = long RVE
h = l;                          %m altura de celda que rodea a grafeno h*Ncells = altura RVE
mui = 0.0;
dmu = 0.01;
muf = 1.0;
kk = 0;
s=0;
for mu = mui:dmu:muf
  mu
    for k = 1 : 1  %1000
        s=s+1;
        [Exxlyr(s),wgg(s)] = CalcYoungMod_4(Ncells,l,h,Emxx,Egxx,tg,mu);
    end
    kk = kk + 1;
    Exxlyr_avg(kk) = mean(Exxlyr);
end

figure(1)
plot(wgg,Exxlyr,'b.')
xlabel('GRAPHENE WEIGHT - Wg')
ylabel('LOGARITHMIC YOUNG MODULUS - LOG(E)')
grid minor on

figure(2)
hist(Exxlyr,100,"facecolor", 0.9*[1,1,1])
xlabel('YOUNG MODULUS -E')

figure(3)
plot([mui:dmu:muf],Exxlyr_avg,'ro-','linewidth',1.5)
xlabel('GRAPHENE WEIGHT - Wg')
ylabel('MEAN YOUNG MODULUS')
grid minor on