symbolic function give error list of equations must not be empty

6 visualizaciones (últimos 30 días)
Arvind
Arvind el 31 de Ag. de 2023
Editada: Torsten el 1 de Sept. 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;
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);
Error using sym/solve>getEqns
List of equations must not be empty.

Error in sym/solve (line 226)
[eqns,vars,options] = getEqns(varargin{:});
it gives error list of equations must not be empty

Respuestas (2)

Torsten
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)
eqn = 5×5 cell array
{[- 1.50803245117100160289805200…]} {0×1 sym} {[-0.741630985575042173186237825…]} {[-0.273318453796381434313474063…]} {[-0.036666321742782345493522954…]} {[- 1.48916970086310853104396701…]} {0×1 sym} {0×1 sym } {[-0.483059574159476671862777574…]} {[-0.125295350090937077535227554…]} {[- 1.47262968887642448579852562…]} {0×1 sym} {0×1 sym } {0×1 sym } {[-0.244736293195321058142013166…]} {[- 1.45800821568923166242724732…]} {0×1 sym} {0×1 sym } {0×1 sym } {0×1 sym } {[- 1.44498973495002902998014471…]} {0×1 sym} {0×1 sym } {0×1 sym } {0×1 sym }

Walter Roberson
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)))
eqns = 
eqn = solve(eqns, Shy, 'returnconditions', true)
eqn = struct with fields:
Shy: z1 parameters: z1 conditions: 441097612290598560747115992176395802713529160140625*phi_den^2 + 15337704370574865851786350481975309086861225957453125*phi_den + 11127350810719612849880020010454453321114917831625…
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×5 cell array
{1×1 struct} {1×1 struct} {1×1 struct} {1×1 struct} {1×1 struct}
sol{1}
ans = struct with fields:
Shy: z1 parameters: z1 conditions: 26735596136480523148143732435098393294929920000*phi_den^6*z1^6 + 211750324448952741718676240015230278584946873600*phi_den^6*z1^5 + 36658159829262792238467084809795552928063287352…
  4 comentarios
Arvind
Arvind el 1 de Sept. de 2023
can this equation solve by another methode without using syms,
Because my data length is phi_den =1366x1 and measure_VEL =1366x1, and it is taking too much time and the equation is not solving
Torsten
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))
Warning: Imaginary parts of complex X and/or Y arguments ignored.

Iniciar sesión para comentar.

Categorías

Más información sobre Symbolic Math Toolbox en Help Center y File Exchange.

Productos


Versión

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by