fsolve issue with high gradient function

Hello,
I am in front of an issue with fsolve, I have a function which varies very very quickly with at least 10 solutions where f(x) = 0
when I plot with log(1+f(x)) I can see where the solutions are :
for example for the sixth one it is 7.2* omg = 399 hz
I verified by plotting the function on the intertval 7.1 7.3 * omg and it cross 0 once (as you can see it is power 20)
So to find the root I tried to do
fre6 = @(x) det(f(x,xi,A,CAP,ns,ork))/10^21;
w6 = fsolve(fre1,7*omg)
fsolve return no solution even if :
  • I change the initial guess
  • I change 10^21 to decrease the gradient
any help will be amazing
I already read some topic such as
but it does not work when I change the initial guess

回答 (1 件)

Matt J
Matt J 2023 年 2 月 20 日
編集済み: Matt J 2023 年 2 月 20 日

0 投票

You should not be using fsolve for a 1D root finding problem, and particularly not when the function is highly non-differentiable. Just do a sweep,
x= linspace(0,9,100);
fvals=arrayfun(fre,x);
loc=find(abs(fvals)<=tolerance);
xroots=x(loc);
Now, if you wish to refine the root calculations, you can use xroots as starting points in calls to fzero.

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

製品

リリース

R2013b

タグ

質問済み:

n n
2023 年 2 月 20 日

編集済み:

2023 年 2 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by