필터 지우기
필터 지우기

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개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by