Difficulty solving simple implicit equation

4 ビュー (過去 30 日間)
Nikolaos Barmpatsalos
Nikolaos Barmpatsalos 2022 年 5 月 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
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.
Nikolaos Barmpatsalos
Nikolaos Barmpatsalos 2022 年 5 月 31 日
Hi guys. Thank you for taking interest in my question. I have edited the initial post with what I tried.

サインインしてコメントする。

採用された回答

Torsten
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
  1 件のコメント
Nikolaos Barmpatsalos
Nikolaos Barmpatsalos 2022 年 6 月 2 日
That worked. Thank you soooo much for your help!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEquation Solving についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by