Difficulty solving simple implicit equation
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Nikolaos Barmpatsalos
il 30 Mag 2022
Commentato: Nikolaos Barmpatsalos
il 2 Giu 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 Commenti
John D'Errico
il 30 Mag 2022
Modificato: John D'Errico
il 30 Mag 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.
Risposta accettata
Torsten
il 31 Mag 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
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Equation Solving in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!