Finding the zeros of a function

I need to find the roots of this function within a big interval:
y = x * cot (x) - 1- gamma * x^2 - ((w * delta * x^2) / (w- x^2))
gamma, delta and w are three parameters (in particular gamma=delta=0.01 and w=10 000).
Firstly, I tried to use the Newton-Ruphson's method, and it is quite good when I consider small interval, but considering big interval, like 0<x<200, it jumps some roots.
Any suggestions?

4 comentarios

James Tursa
James Tursa el 12 de Nov. de 2020
Plot the function over the range interested to get an idea of where all the roots are. Then use starting guesses based on the plots to get the various roots.
Giacomo De Angelis
Giacomo De Angelis el 12 de Nov. de 2020
I already done it, basically there is a root every pi interval. The code that I wrote is able to find the first roots within 0<x<40 but, as I said, when I consider big interval it jumps some zeros.
I tried to use fzero instead Newton-Ruphson but the code gives me also the multiple of pi, but I don't know why.
John D'Errico
John D'Errico el 13 de Nov. de 2020
Since you don't show the code you have a problem with, we need to peer into your mind, inside your computer. Sadly, the crystal ball toolbox is on the fritz today.
Giacomo De Angelis
Giacomo De Angelis el 13 de Nov. de 2020
Don't worry, I solved the problem by myself.

Iniciar sesión para comentar.

Respuestas (1)

John D'Errico
John D'Errico el 12 de Nov. de 2020

0 votos

That is the expected behavior of a method like NR. Sorry, but it is. Seriously, NR is literally the WRONG way to try to solve such a problem.
Instead, use a search, evaluating the function at a sequence of points, closely spaced enough to insure that all roots will lie between some pair of points.
If the function changes sign, then use fzero on the pair of points that bracket the root you just found.
DON'T WRITE YOUR OWN CODE FOR A ROOT FINDER! While your teacher may have taught you how to do so, they always seem to forget to tell you the most important thing: use existing well written code to do the real work. Don't write your own numerical methods software. Learn how the tools work. That is a good thing. But then stop. Use the proper tools that already exist.

Categorías

Más información sobre Parallel Computing en Centro de ayuda y File Exchange.

Preguntada:

el 12 de Nov. de 2020

Comentada:

el 13 de Nov. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by