I'm wanting to plot a graphic of an image, called Newton Fractal:
Followtemplate:
Theproblemistoplottherootsofthez^4=1
equation,whereithas4rootsbeing(-1,1,iand-i),wheretofindtherootsIuseNewton'smethodtoapproximate.Thedifferentcolors(red,green,yelloworblue)intheimagemeantowhichrootNewton'smethodisapproaching(andblackifitisnotany),butIamnotabletomakethecodethatgeneratestheimage.I'musingscilabwhichisverysimilartomatlab.
Here'swhatIwasabletodo:
function [z] = f(x,y)
clc
f(x,y) = z^4 -1 = 0;
f1(x,y) = 4*z^3;
niter = 100;
x0 = 0.5;
for i=1:niter
for j=1:niter;
end
[X,Y] = meshgrid(x,y);
Z(i,j) = f(x(i), y(j) );
end
end
surf(X,Y,Z)
endfunction.