Array indices must be positive integers or logical values.
Show older comments
y=input('thecomplexvalue of z=');
x=input('therealvalue of z=');
tol=input('the value tolerance tol=');
z=x+1i*y;
funcnew01=z^5+z^3-pi;
funcnew02=diff(funcnew01);
k=0;
if real(z)==0
y=z;
disp('y funcnew01(y) funcnew02(y) k')
disp('........................................')
while abs(funcnew01(y))>tol
y=y-(funcnew01(y)/funcnew02(y));
k=k+1;
end
else
x=z;
disp('x funcnew01(x) funcnew(x) k')
disp('......................................')
while abs(funcnew01(x))>tol
x=x-(funcnew01(x)/funcnew02(x));
k=k+1;
end
end
I get this error in line 20, I'm not shure why I'm trying to make a code for finding the roots of the complex function with the Newton-Raphson method
Accepted Answer
More Answers (0)
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!