Hi All,
I've written a code using Newton-Raphson algorythm but i have problems with tabulating. I want to tabulate my results in a form which first column corresponds "it_no"(iteration number),second column corresponds "x", third column corresponds "f(x)". But I'm only getting the last results of iteration, i.e it_no 9;
Here is the code
f=@(x)x^5-x^4+(2*x^3)-(3*x^2)+x-4dfdx=@(x)(5*x^4)-(4*x^3)+(6*x^2)-(6*x)+1x0=5x=x0it_no=0while 1 f(x) it_no=it_no+1 xprev=x x=xprev-(f(x)./dfdx(x)) if f(x)<10^-4 break end endfprintf('\n\n%18s%18s%18s\n','it_no','x','f(x)')fprintf(' %17.0f\t %17.7f\t %17.7f\t\n',[it_no,x,f(x)])
I want to see all results from first iteration to last iteration. Anyway to see previous results in my table?
I'll appreciate for any help
Thanks Already!
Best Answer