Hello,
I want to plot my code, but when i write the code there is no line in the graph. I want 2 graphs, one is f(x) versus i and one is x versus i. Also how can I write a function for the circle mark for each data point in the function? ( I use Matlab R2015a )
Thank you..
clcclear allclose allfprintf('%10s %10s %10s %10s %10s\n','i','xi','f(xi)','diff_f(xi)','|Ea|')x = 0;i = 1;while i <= 50 f = @(x) x^3 - x - 3 ; diff = @(x) 3*(x^2) - 1 ; xnew = x - (f(x) / diff(x)); if abs(((xnew-x)/xnew)*100) < 10^(-3) break end fprintf('%10.4f %10.4f %10.4f %10.4f %10.4f\n',i,x,f(x),diff(x),abs((xnew-x)/xnew)*100) x = xnew; i =i+1; end
Best Answer