newton raphson on matlab

1 vue (au cours des 30 derniers jours)
somebody on the net
somebody on the net le 9 Avr 2021
i've been given this code to execute for x0=0; n=50; tol=10^-3 is the 0 the problem because cos(0)/-sin(0) is undefinable or is there another problem in the typing/defining? please help it's is due for tomorrow

Réponses (1)

DGM
DGM le 10 Avr 2021
Modifié(e) : DGM le 10 Avr 2021
I don't know why anyone would make you use x0=0 unless they wanted you to lose your hair. Think about where you are on the curve of cos(x). Think about where your tangent line is. Algebraically, you know that 1/0 is undefined, but geometrically, you're looking for the intersection of two parallel lines -- something you're not going to find either.
You should begin to see that the periodic nature of the sinusoids means that you'll need to pick a starting point close to a desired root, or else you'll end up overshooting and finding one way off down the line. Try x0=0.1 and then try x0=1.5.
Also, this is probably supposed to be x0 instead of p0.
fprintf('\nApproximate solution xn= %11.8f \n\n',p0);
  1 commentaire
somebody on the net
somebody on the net le 10 Avr 2021
thank you so much!

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by