Difficulty solving simple implicit equation
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Nikolaos Barmpatsalos
le 30 Mai 2022
Commenté : Nikolaos Barmpatsalos
le 2 Juin 2022
Hi guys,
I am struggling to solve numerically a pretty simple implicit equation.I want to solve for Im.
Im = ((Imax-Imin).*L +Imin).*sinh(a.*V-Im*R);
R and a are constants (around 50 and 1.3 respectivelly)
V is an 126x1 double - starts at 0 and increases linearly (steps of 0.02) to 2.5
L is an 1x126 array - starts at 1 and decreases exponentially to 0
My simple code is:
syms Im;
S = vpasolve(((Imax-Imin).*letSee +Imin).*sinh(a.*V-Im*R)-Im == 0, Im);
I receive the following error:
Error using mupadengine/feval (line 195)
More equations than variables is only supported for polynomial systems.
Error in sym/vpasolve (line 172)
sol = eng.feval('symobj::vpasolve',eqns,vars,X0);
Any help?
4 commentaires
John D'Errico
le 30 Mai 2022
Modifié(e) : John D'Errico
le 30 Mai 2022
True. But that is not a direct solution, nor one that a new user would be expected to find. A loop is probably simpler. If a direct solution was available, then one could just use solve, and then substitute the sets of vectos in question. Were a solution to exist, it would probably involve either a Lambert W or Wright omega. But the sinh complicated things, instead of a simple exponential. So even without trying it, my guess is the direct solve will fail. And that means a simple loop, using fzero or vpasolve is probably simplest.
However, in anycase, if lmax and lmin are not provided, then both fzero AND vpasolve must fail. So that means there is probably no solution available at all. IF lmax and lmin are not both provided.
Réponse acceptée
Torsten
le 31 Mai 2022
Imin = ...;
Imax = ...;
a = ...;
R = ...;
V = array of values
L = array of values
fun = @(Im,V,L) Im - ((Imax-Imin).*L +Imin).*sinh(a.*V-Im*R);
guess = 1.0;
for i = 1:numel(L)
f = @(Im) fun(Im,V(i),L(i));
sol(i) = fsolve(f,guess);
guess = sol(i);
end
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Equation Solving dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!