Root Finding Newton Method

1 visualizzazione (ultimi 30 giorni)
Jacob Janson
Jacob Janson il 17 Ott 2020
Risposto: Walter Roberson il 17 Ott 2020
I am a beginner at coding working on this homework assignment to make a working Newton method root finder. When I do this on paper I can figure out what needs to happen. I am so lost to getting it into code. I think that I need to put in a new variable to find the roots of a function but I'm really uncertain how to do that. Can anyone help me out?
function [y] = Newton_3397(chuckie,x)
syms x
%chuckie(x)=x.^2-7
y=x-(chuckie(x)/diff(chuckie(x)));
y=vpa(subs(y,x,1));
ans=y-(chuckie(x)/diff(chuckie(x)))
end

Risposte (1)

Walter Roberson
Walter Roberson il 17 Ott 2020
function [y] = Newton_3397(chuckie,x)
syms x
You should not be ignoring the input x value. The user is supposed to pass you an initial value, the point to start at.
function [y] = Newton_3397(chuckie,x0)
and
x0=vpa(subs(y,x,x0));
and you just repeat that same assignment several times until you are satisfied that the error is low enough.

Categorie

Scopri di più su Systems of Nonlinear Equations in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by