Info

此问题已关闭。 请重新打开它进行编辑或回答。

problem on solve function,the result is empty sym:0-by-1

1 次查看(过去 30 天)
i got some trouble when i run this script function, at the solve function the result is empty sym:0-by-1, i am relatively new in MatLab can anyone help me?
function[u_g] = viscosity(Pm) % viscosity() calculates viscosity of the gas at given reservoir % temperature and pressure.
M_air=[28.96;29;29.56;30;31;31.86;32;32.3;33;33.50];
Avg_Mol_Wt= [25.48;26;26.12;26.79;27;27.60;28;29;29.40;30];
spgr=Avg_Mol_Wt.\M_air;
Pm=[3800;3850;3400;3450;3500;3550;3600;3650;3700;3750]; %initial reservoir pressure
T=[660;680;720;740;760;780;800;820;840;860]; %Reservoir Temperature= 660 deg R (Literature)
u_uncorrected = ((1.709 * (10^(-5)-(2.062*10^(-6)*spgr))).*(T-460))+((8.118*10^(-3))-(6.15*10^(-3)*log10(spgr)));
yCO2 = 0.03;
yN2 = 0.02;
yH2S = 0.01;
u_CO2 = (yCO2*(((9.08*10^(-3))*(log10(spgr)))+ (6.24*10^(-3))));
u_N2 = (yN2*((8.48*10^(-3)*log10(spgr))+ (9.59*10^(-3))));
u_H2S = (yH2S*((8.49*10^(-3)*log10(spgr))+ (3.73*10^(-3))));
u1 = u_uncorrected + u_CO2 + u_N2 + u_H2S ;
Tpc = 168 + (325 * spgr) -(12.5*(spgr.^2));
Ppc = 677 + (15*spgr) -(37.5*(spgr.^2));
Tpr = T.\Tpc;
Ppr = Pm.\Ppc;
% Constants for viscosity relation
na=[1
1
1
1
1
1
1
1
1
1];
a0 = na.*-2.5;
a1 = na.*3;
a2 = na.*-0.29;
a3 = na.* 0.008;
a4 = na.*2.89;
a5 = na.* -3.5;
a6 = na.*0.36;
a7 = na.*-0.01;
a8 = na.*-0.8;
a9 = na.*1.4;
a10 = na.*-0.15;
a11 = na.*0.0044;
a12 = na.*0.084;
a13 = na.*-0.18;
a14 = na.*0.02;
a15 = na.*-0.0006;
syms ug;
con = a0+(a1.*Ppr)+(a2.*(Ppr.^2))+ (a3.*(Ppr.^3)) +(Tpr.*(a4+(a5.*Ppr))+(a6.*(Ppr.^2))+(a7.*(Ppr.^3))+((Tpr.^2).*(a8+(a9.*Ppr)))+(a10.*(Ppr.^2))+(a11.*(Ppr.^3)))+((Tpr.^3).*(a12+(a13.*Ppr)+(a14.*(Ppr.^2))+(a15.*(Ppr.^3))))
eqn = ((Tpr.*ug) == u1.*exp(con));
temp= solve(eqn,'ug')
u_g = double(temp);
end
the result
>> viscosity
con =
-0.5039
-0.5552
-0.5859
-0.6263
-0.6414
-0.6689
-0.7055
-0.7509
-0.7738
-0.8039
temp =
Empty sym: 0-by-1
ans =
0×1 empty double column vector

回答(0 个)

此问题已关闭。

产品


版本

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by