symbolic function give error list of equations must not be empty
3 次查看(过去 30 天)
显示 更早的评论
syms Shy
por_den = 0.4:0.1:0.8; W= 1.2; rho_ma = 2.75; rho_water = 1.03; rho_hydrate = 0.90;
measure_VEL=1.4:0.1:1.8; vw= 1.49; vm = 3.5;vhy = 3.299;
eqn = solve('1/measure_VEL = (W*phi_den*(1-Shy)/(1/sqrt(((1-phi_den)*rho_ma + (1-Shy)*phi_den*rho_water + Shy*phi_den*rho_hydrate)*((phi_den*(1-Shy)/(rho_water*vw^2)) + (phi_den*Shy/(rho_hydrate*vhy^2)) + ((1-phi_den)/(rho_ma*vm^2)))))) + ((1 - W*phi_den*(1 - Shy))/((phi_den*(1-Shy)/vw) + (phi_den*Shy/vhy) + ((1-phi_den)/vm)))', Shy);
it gives error list of equations must not be empty
0 个评论
回答(2 个)
Torsten
2023-8-31
编辑:Torsten
2023-8-31
syms Shy
Por_den = 0.4:0.1:0.8; W= 1.2; rho_ma = 2.75; rho_water = 1.03; rho_hydrate = 0.90;
Measure_VEL=1.4:0.1:1.8; vw= 1.49; vm = 3.5;vhy = 3.299;
[por_den,measure_VEL]=meshgrid(Por_den,Measure_VEL);
eqn = arrayfun(@(measure_VEL,por_den)vpasolve(1/measure_VEL == (W*por_den*(1-Shy)/(1/sqrt(((1-por_den)*rho_ma + (1-Shy)*por_den*rho_water + Shy*por_den*rho_hydrate)*((por_den*(1-Shy)/(rho_water*vw^2)) + (por_den*Shy/(rho_hydrate*vhy^2)) + ((1-por_den)/(rho_ma*vm^2)))))) + ((1 - W*por_den*(1 - Shy))/((por_den*(1-Shy)/vw) + (por_den*Shy/vhy) + ((1-por_den)/vm))), Shy),measure_VEL,por_den,'UniformOutput',0)
0 个评论
Walter Roberson
2023-8-31
syms Shy
syms phi_den
por_den = 0.4:0.1:0.8; W= 1.2; rho_ma = 2.75; rho_water = 1.03; rho_hydrate = 0.90;
measure_VEL=1.4:0.1:1.8; vw= 1.49; vm = 3.5;vhy = 3.299;
eqns = 1./measure_VEL == (W*phi_den*(1-Shy)./(1./sqrt(((1-phi_den)*rho_ma + (1-Shy)*phi_den*rho_water + Shy*phi_den*rho_hydrate)*((phi_den*(1-Shy)./(rho_water*vw^2)) + (phi_den*Shy./(rho_hydrate*vhy^2)) + ((1-phi_den)./(rho_ma*vm^2)))))) + ((1 - W*phi_den*(1 - Shy))./((phi_den*(1-Shy)./vw) + (phi_den*Shy./vhy) + ((1-phi_den)./vm)))
eqn = solve(eqns, Shy, 'returnconditions', true)
Notice that you assign a value to por_den but never use por_den and you use phi_den without having defined it.
Notice that you are creating vectors, so you are constructing a vector of equations. When you ask to solve(), solve() always tries to solve for values of the unknowns that satisfy all of the equations at the same time. For example if you ask to solve [A+B==5 3*A+4*B==11] then it is going to find the single A and single B that results in both conditions being met. It is not going to find the general solution for A+B==5 and put that in the list, and then independently create the general solution to 3*A+4*B==11 and put that the list.
You should probably be doing something like
sol = arrayfun(@(EXPR) solve(EXPR, Shy, 'returnconditions', true), eqns, 'uniform', 0)
sol{1}
4 个评论
Torsten
2023-9-1
编辑:Torsten
2023-9-1
For a given value pair of phi_den and measure_VEL, I suggest to plot your expression as a function of Shy and see if it crosses the x-axis to see whether a (real) solution exists.
E.g. for por_den = 0.6 and measure_VEL = 1.6, this does not seem to be the case:
syms Shy
por_den = 0.6; W= 1.2; rho_ma = 2.75; rho_water = 1.03; rho_hydrate = 0.90;
measure_VEL=1.6; vw= 1.49; vm = 3.5;vhy = 3.299;
f = 1/measure_VEL - (W*por_den*(1-Shy)/(1/sqrt(((1-por_den)*rho_ma + (1-Shy)*por_den*rho_water + Shy*por_den*rho_hydrate)*((por_den*(1-Shy)/(rho_water*vw^2)) + (por_den*Shy/(rho_hydrate*vhy^2)) + ((1-por_den)/(rho_ma*vm^2)))))) + ((1 - W*por_den*(1 - Shy))/((por_den*(1-Shy)/vw) + (por_den*Shy/vhy) + ((1-por_den)/vm)));
F = matlabFunction(f);
Shy = 0.01:0.1:10;
plot(Shy,F(Shy))
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!