Can help me to correct the code for calculation for given condition of por_cr

2 次查看(过去 30 天)
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;

采纳的回答

Torsten
Torsten 2024-2-2
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
Kdryh = 1×7
21.2981 14.5911 11.3930 7.9100 10.8620 20.0427 20.2552
Gdryh
Gdryh = 1×7
46.3521 44.2461 14.9474 9.6074 13.9380 53.1788 37.0903
  5 个评论
Torsten
Torsten 2024-2-3
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
Kdry1 = 7×1
21.2981 14.5911 NaN NaN NaN 20.0427 20.2552
Kdry2
Kdry2 = 7×1
NaN NaN 11.3930 7.9100 10.8620 NaN NaN
Gdry1
Gdry1 = 7×1
46.3521 44.2461 NaN NaN NaN 53.1788 37.0903
Gdry2
Gdry2 = 7×1
NaN NaN 14.9474 9.6074 13.9380 NaN NaN

请先登录,再进行评论。

更多回答(0 个)

产品


版本

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by