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 Exchange에서 Creating 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