- /
-
Distorted Newton's Method Fractal III
on 29 Oct 2024
- 10
- 30
- 0
- 0
- 493
Cite your audio source here (if applicable):
drawframe(1);
Write your drawframe function below
function drawframe(f)
% Create a fractal using a distorted version
% of Newton's method
persistent p rng iter g CM z0 dp hax
% Initialize
if f == 1
clf
p=conv([1 0 0 0 1],[1,0,0,0,-64]);
dp = polyder(p);
rng = 6*[-1 -1 1 1];
iter=10;
% g(f/96) will trace out a semicircle in the complex plane
g=@(x)(exp((x-1/2)*1i*pi)/2);
CM = 'colorcube';
set(gcf, 'Color', 'w')
hax = gca;
% position axes Not needed here
% hax.Units = 'normalized';
% hax.Position=[0,0,1,1];
% hax.Units = 'pixels';
% SZ = hax.Position;
% DZ = floor(SZ(4));
DZ=500;
% square array of complex numbers
[x,y] = meshgrid(linspace(rng(1),rng(3),DZ),linspace(rng(2),rng(4),DZ));
z0 = x + 1i*y;
%HF = gcf;
end
z = z0;
r = 1+g(f/96); % Ordinary Newton's method uses r = 1
for j = 1:iter
dz = polyval(p,z)./polyval(dp,z);
dz(isnan(dz))=0;
dz(isinf(dz))=0;
z=z-r*dz;
end
imagesc(angle(z))
axis equal square
axis off
hax.YLim = [-100 510];hax.XLim = [-100 510];
colormap(CM)
end
Movie
Audio
This submission does not have audio.