Difficulty solving simple implicit equation
4 次查看(过去 30 天)
显示 更早的评论
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 个评论
John D'Errico
2022-5-30
编辑:John D'Errico
2022-5-30
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.
采纳的回答
Torsten
2022-5-31
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
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Equation Solving 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!