What could be the reason for this fzero error and how to solve it ?

3 vues (au cours des 30 derniers jours)
VIGNESH BALAJI
VIGNESH BALAJI le 2 Fév 2024
Commenté : VIGNESH BALAJI le 9 Fév 2024
This is the error message
This was the warning I got too along with the error message
This is the 5 lines of code to reproduce the error
dd = 0.1069;
vv = 0.7889;
L = 1;
fun = @(aa) ( (-(sqrt(L^2-(vv)^2)/2)) + (aa*sinh(((dd)/2)/aa)) ); xx0 = 0.15; %[10^-6, 10^6];
aa = abs(fzero(fun,xx0));
  13 commentaires
Torsten
Torsten le 7 Fév 2024
If you look at the f(a) and f(b) values in your output, you can see that both are negative in all iterations. Thus fzero does not find a sign change and keeps on serching for suitable limits a and b for which f(a)*f(b) < 0 holds.
VIGNESH BALAJI
VIGNESH BALAJI le 9 Fév 2024
@Torsten thanks, I now understand the reason behidn fzero error. Both your answer and @Dyuman Joshi heped me to solve this problem. I am not sure how to accept both of your answers to close this thread.

Connectez-vous pour commenter.

Réponses (2)

Torsten
Torsten le 2 Fév 2024
Use "fsolve" instead of "fzero":
aa = fsolve(fun,xx0)

Matt J
Matt J le 2 Fév 2024
Modifié(e) : Matt J le 2 Fév 2024
You should plot the function to get a better idea where the solution is,
dd = 0.1069;
vv = 0.7889;
L = 1;
fun = @(aa) ( (-(sqrt(L^2-(vv)^2)/2)) + (aa*sinh(((dd)/2)/aa)) );
fplot(fun,[0.01,0.05])
Warning: Function behaves unexpectedly on array inputs. To improve performance, properly vectorize your function to return an output with the same size and shape as the input arguments.
fzero(fun,[0.01,0.05])
ans = 0.0142
  2 commentaires
VIGNESH BALAJI
VIGNESH BALAJI le 6 Fév 2024
Does matlab have an inbuilt function for the newton - raphson method ?

Connectez-vous pour commenter.

Catégories

En savoir plus sur Optimization dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by