Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Problem with nonlinear solver fsolve??

1 回表示 (過去 30 日間)
ghazal mohamed
ghazal mohamed 2018 年 1 月 8 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hi everyone,
I try to solve
g=@(x)((0.01783926*sin(0.02077086*x)/7155831.61*x)-1.7519952539)
using fsolve toolbox with this options:
options=optimoptions('fsolve','algorithm','Levenberg-Marquardt','Display','off');
but it returns x0 that i passed in parameter see this examples:
>> fsolve(g,0.1,options)
ans =
0.1000
>>fsolve(g,222,options)
ans =
222.0000
fsolve(g,pi,options)
ans =
3.1416
how i can choose the x0 to get a correcte solution?
thanks
  2 件のコメント
Torsten
Torsten 2018 年 1 月 8 日
Plot your function and you'll find the reason.
Best wishes
Torsten.
ghazal mohamed
ghazal mohamed 2018 年 1 月 9 日
Ok,Torsten Thank you for your reply.

回答 (1 件)

John D'Errico
John D'Errico 2018 年 1 月 8 日
Note my use of .* in there, to allow vectorized input.
g=@(x)((0.01783926*sin(0.02077086*x)/7155831.61.*x)-1.7519952539)
ezplot(g,[0 5000])
grid on
Se that your function pretty much never crosses zero. Although, if I allow it to go out much further, it could, since the swings oscillate in size proportionally with x.
So I think you have a problem in your function definition.
  1 件のコメント
ghazal mohamed
ghazal mohamed 2018 年 1 月 9 日
Hi john, thank you for your reply, yes the problem is with the function's expression.

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by