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
John D'Errico le 30 Mai 2022
Modifié(e) : John D'Errico le 30 Mai 2022
It is best to show what you tried. Then someone will just need to show you what to fix. Otherwise someone needs to write the complete solution for you. By showing your code, it also makes it easier for someone to decide to help you, since it is then clear that you did make some effort.
Note that fzero CANNOT be used to solve multiple vectorized problems, and since you tell us that V is a vector and L is also a vector, then you CANNOT use fzero directly. You also CANNOT use vpasolve.
As far as the variables V and L go, you also need to be far more specific what You mean by log and linear. That is, while I can guess that for V to be a linear vector that spans [0,2.5] you have used linspace. But what is L? By being clear, and by actually showing some code, you make it easier for somoen to help you.
So what did you try? SHOW your CODE. Put it into either a comment on your question, or by editting your question, NOT as an answer.
vpasolve could be used together with arrayfun
John D'Errico
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.
Hi guys. Thank you for taking interest in my question. I have edited the initial post with what I tried.

Connectez-vous pour commenter.

 Réponse acceptée

Torsten
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)

Community Treasure Hunt

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

Start Hunting!

Translated by