In fact, how do I get the plot to plot ALL values!
Here's my script without any plotting being done. The program gives the final value of x correctly. But how can I get it to plot the initial values I gave it, aswell as each intermediate value in Newton's Method?
i = 1;
% Define first index.
x = 1;
%Define first point for method.
f = @(x) (x - sin(x)-1);
df = @(x) (1-cos(x));
%Define derivative of function.
%Loop carries out Newton's Method.
while abs(f(x)/df(x)) > 0.000001
x = x - (f(x)/df(x));
i = i+1;
%Display the solution in long format.