symbolic function give error list of equations must not be empty
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (2)
Torsten
el 31 de Ag. de 2023
Editada: Torsten
el 31 de Ag. de 2023
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 comentarios
Walter Roberson
el 31 de Ag. de 2023
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 comentarios
Torsten
el 1 de Sept. de 2023
Editada: Torsten
el 1 de Sept. de 2023
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))
Ver también
Categorías
Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!