Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
33
Task/Mandelbrot-set/MATLAB/mandelbrot-set-1.m
Normal file
33
Task/Mandelbrot-set/MATLAB/mandelbrot-set-1.m
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
function [theSet,realAxis,imaginaryAxis] = mandelbrotSet(start,gridSpacing,last,maxIteration)
|
||||
|
||||
%Define the escape time algorithm
|
||||
function escapeTime = escapeTimeAlgorithm(z0)
|
||||
|
||||
escapeTime = 0;
|
||||
z = 0;
|
||||
|
||||
while( (abs(z)<=2) && (escapeTime < maxIteration) )
|
||||
z = (z + z0)^2;
|
||||
escapeTime = escapeTime + 1;
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
%Define the imaginary axis
|
||||
imaginaryAxis = (imag(start):imag(gridSpacing):imag(last));
|
||||
|
||||
%Define the real axis
|
||||
realAxis = (real(start):real(gridSpacing):real(last));
|
||||
|
||||
%Construct the complex plane from the real and imaginary axes
|
||||
complexPlane = meshgrid(realAxis,imaginaryAxis) + meshgrid(imaginaryAxis(end:-1:1),realAxis)'.*i;
|
||||
|
||||
%Apply the escape time algorithm to each point in the complex plane
|
||||
theSet = arrayfun(@escapeTimeAlgorithm, complexPlane);
|
||||
|
||||
|
||||
%Draw the set
|
||||
pcolor(realAxis,imaginaryAxis,theSet);
|
||||
shading flat;
|
||||
|
||||
end
|
||||
1
Task/Mandelbrot-set/MATLAB/mandelbrot-set-2.m
Normal file
1
Task/Mandelbrot-set/MATLAB/mandelbrot-set-2.m
Normal file
|
|
@ -0,0 +1 @@
|
|||
mandelbrotSet(-2.05-1.2i,0.004+0.0004i,0.45+1.2i,500);
|
||||
Loading…
Add table
Add a link
Reference in a new issue