Can help me to correct the code for calculation for given condition of por_cr
2 views (last 30 days)
Show older comments
por_cr= 0.22;
por = (0.1,0.2,0.3,0.5,0.34,0.12,0.1)';
Gt = (20,21,21,28,23,25,14)';
Kt = (32,33,31,28,33,29,,34)';
Pe = (14,14.4,15,14,14.2,15.5,14)';
poisson = 0.5.*((Kt-2.*Gt./3)./(Kt + Gt./3));
c =8;
Khm = ((c.^2).*((1-por_cr).^2).*(Gt.^2).*Pe./(18*pi.*pi.*(1-poisson).^2)).^(1/3);
Ghm = ((5-4*poisson)./(5.*(2-poisson))).*(3.*(c.^2).*((1-por_cr).^2).*(Gt.^2).*Pe./(2*pi.*pi.*(1-poisson).^2)).^(1/3);
Z = (Ghm./6).*((9*Khm + 8*Ghm)./(Khm + 2*Ghm));
if por<=por_cr
Kdryh = (((por./por_cr)./(Khm +4*Ghm/3)) + ((1-por./por_cr)./(Kt + 4*Ghm/3))).^(-1) - 4.*Ghm./3;
Gdryh = (((por./por_cr)./((1-por_cr).*(Ghm +Z))) + ((1-por./por_cr)./(Gt+Z))).^(-1) + Z;
elseif por>=por_cr
Kdryh = (((1-por)./(1-por_cr)).*(1./(Khm + 4.*Ghm./3)) + ((por - por_cr)./(1 - por_cr))./(4.*Ghm./3)).^(-1) - 4.*Ghm./3;
Gdryh= (((1-por)./(1-por_cr)).*(1./(Ghm+Z)) + ((por-por_cr)./(Z.*(1-por_cr)))).^(-1) -Z;
end
Kdryh;
Gdryh;
0 Comments
Accepted Answer
Torsten
on 2 Feb 2024
por_cr= 0.22;
por = [0.1,0.2,0.3,0.5,0.34,0.12,0.1]';
Gt = [20,21,21,28,23,25,14]';
Kt = [32,33,31,28,33,29,34]';
Pe = [14,14.4,15,14,14.2,15.5,14]';
poisson = 0.5.*((Kt-2.*Gt./3)./(Kt + Gt./3));
c =8;
Khm = ((c.^2).*((1-por_cr).^2).*(Gt.^2).*Pe./(18*pi.*pi.*(1-poisson).^2)).^(1/3);
Ghm = ((5-4*poisson)./(5.*(2-poisson))).*(3.*(c.^2).*((1-por_cr).^2).*(Gt.^2).*Pe./(2*pi.*pi.*(1-poisson).^2)).^(1/3);
Z = (Ghm./6).*((9*Khm + 8*Ghm)./(Khm + 2*Ghm));
for i = 1:numel(por)
if por(i)<=por_cr
Kdryh(i) = (((por(i)./por_cr)./(Khm(i) +4*Ghm(i)/3)) + ((1-por(i)./por_cr)./(Kt(i) + 4*Ghm(i)/3))).^(-1) - 4.*Ghm(i)./3;
Gdryh(i) = (((por(i)./por_cr)./((1-por_cr).*(Ghm(i) +Z(i)))) + ((1-por(i)./por_cr)./(Gt(i)+Z(i)))).^(-1) + Z(i);
else
Kdryh(i) = (((1-por(i))./(1-por_cr)).*(1./(Khm(i) + 4.*Ghm(i)./3)) + ((por(i) - por_cr)./(1 - por_cr))./(4.*Ghm(i)./3)).^(-1) -4.*Ghm(i)./3;
Gdryh(i)= (((1-por(i))./(1-por_cr)).*(1./(Ghm(i)+Z(i))) + ((por(i)-por_cr)./(Z(i).*(1-por_cr)))).^(-1) -Z(i);
end
end
Kdryh
Gdryh
5 Comments
Torsten
on 3 Feb 2024
Maybe something like this:
por_cr= 0.22;
por = [0.1,0.2,0.3,0.5,0.34,0.12,0.1]';
Gt = [20,21,21,28,23,25,14]';
Kt = [32,33,31,28,33,29,34]';
Pe = [14,14.4,15,14,14.2,15.5,14]';
poisson = 0.5.*((Kt-2.*Gt./3)./(Kt + Gt./3));
c =8;
Khm = ((c.^2).*((1-por_cr).^2).*(Gt.^2).*Pe./(18*pi.*pi.*(1-poisson).^2)).^(1/3);
Ghm = ((5-4*poisson)./(5.*(2-poisson))).*(3.*(c.^2).*((1-por_cr).^2).*(Gt.^2).*Pe./(2*pi.*pi.*(1-poisson).^2)).^(1/3);
Z = (Ghm./6).*((9*Khm + 8*Ghm)./(Khm + 2*Ghm));
Kdry1 = nan(size(por));
Kdry2 = Kdry1;
Gdry1 = Kdry1;
Gdry2 = Kdry1;
for i = 1:numel(por)
if por(i)<=por_cr
Kdry1(i) = (((por(i)./por_cr)./(Khm(i) +4*Ghm(i)/3)) + ((1-por(i)./por_cr)./(Kt(i) + 4*Ghm(i)/3))).^(-1) - 4.*Ghm(i)./3;
Gdry1(i) = (((por(i)./por_cr)./((1-por_cr).*(Ghm(i) +Z(i)))) + ((1-por(i)./por_cr)./(Gt(i)+Z(i)))).^(-1) + Z(i);
else
Kdry2(i) = (((1-por(i))./(1-por_cr)).*(1./(Khm(i) + 4.*Ghm(i)./3)) + ((por(i) - por_cr)./(1 - por_cr))./(4.*Ghm(i)./3)).^(-1) -4.*Ghm(i)./3;
Gdry2(i)= (((1-por(i))./(1-por_cr)).*(1./(Ghm(i)+Z(i))) + ((por(i)-por_cr)./(Z(i).*(1-por_cr)))).^(-1) -Z(i);
end
end
Kdry1
Kdry2
Gdry1
Gdry2
More Answers (0)
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!