Hello, I am having trouble coding a solution using the Newton Raphson method. I need to input a negative x0 number, but I am getting the error, 'Array indices must be positive integers or logical values.'. Please help!
clc; clear x0=input('Enter intial guess: ');i=1;I=100;err=0.1;while((err>1e-3) && i<I) x=x0;fx(x)=(3/500)*(x^3 - 18.535*x^2 + 25.697*x + 28.099);pfx(x)= ((9000*x^2)-(111210*x)+77091)/500000;x1=x-((fx(x))/(pfx(x)));err=abs(x-x1);x=x1;i=i+1;enddisp('Root of the function')x(end)
Best Answer