Problem with non-linear implicit equation using fsolve

5 views (last 30 days)
Hi guys,
I am trying to solve the following implicit equation using fsolve.
L = ( (B./sinh(a.*A.*L-B.*R)) - bmin) ./ (bmax-bmin);
I am trying to solve for L.
A, B are array inputs (A is in the 10^-3 range and B is [0:0.05:2.5])
a = 1.5
R = 190
bmax = 0.0024139
bmin = 9.779e-10
The expected L (blue points in graph) should be around 0.9. However, I get values in the range of 10^-7.
I am using the following script:
anonFun = @(L,B,A) L -(((B./sinh(a.*A-B.*R)) - bmin)./(bmax-bmin));
guess = 1;
for i = 1:numel(input{1}(:,1))
fun = @(lamda) los(lamda,input{1}(i,2),input{1}(i,1));
sol(i) = fsolve(lostos,guess);
guess = sol(i);
end
In the graph below you can see the desired answer in blue and the one I'm getting in orange.
Could you please tell me what's wrong with it?
Thank you for your time!

Answers (1)

John D'Errico
John D'Errico on 15 Sep 2022
Edited: John D'Errico on 15 Sep 2022
a = 1.5;
R = 190;
bmax = 0.0024139;
bmin = 9.779e-10;
Since you do not tell us the values of A and B, only the range, I'll pick some numbers in that range.
B = 1;
A = 1e-3;
fun = @(L) L - ( (B./sinh(a.*A.*L-B.*R)) - bmin) ./ (bmax-bmin);
fplot(fun)
grid on
xlabel L
Now, to me, it looks like something very near zero is quite reasonable for L.
What did the solver produce? AMAZING! Something generally near zero.
Do you have the wrong equation? Perhaps. But that is something we cannot know.

Products

Community Treasure Hunt

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

Start Hunting!