Hi All,
I have some results in complex form. I want to tabulate these results by using fprintf but I just get the real parts of numbers on my command window. Here is my code:
g=@(x)x^4-(0.4982*x^3)+(2.7464*x^2)-(1.1146*x)+(2.6699)dgdx=@(x)(4*x^3)+(1.4946*x^2)+(5.4928*x)+(1.1146)x0=1+ix=x0it_no=0fprintf('\n\n%18s%18s%18s\n','it_no','x','g(x)');while 1 it_no=it_no+1; xprev=x; x=xprev-(g(x)./dgdx(x)); if abs(g(x))<10^-4; break end fprintf(' %17.0f\t %17.7f\t %17.7f\t\n',[it_no,x,g(x)]);endfprintf(' %17.0f\t %17.7f\t %17.7f\t\n',[it_no,x,g(x)])
How can I tabulate both real and imaginary parts of complex numbers using fprintf? Anyone to help me for this problem?
I'll appreciate for any help.
Thanks Already!
Best Answer