Root Finding Newton Method

1 次查看(过去 30 天)
Jacob Janson
Jacob Janson 2020-10-17
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

回答(1 个)

Walter Roberson
Walter Roberson 2020-10-17
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.

类别

Help CenterFile Exchange 中查找有关 Systems of Nonlinear Equations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by