lkj

Plain text code posted
created at 16 Oct 00:47, updated at 16 Oct 00:48

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
c1=-.75; c2= .375+.333*i; c3= -.117-.856*i; c4=-.75+.113*i; c5=-0.561+0.641*i;  %choose one of them
c= c1; 
if abs(c)>=2  
disp('TOO BIG');
end;
z0=-1.5-1.5*i; z1=1.5+1.5*i; % min and max z
x0 = real(z0); y0 = imag(z0);
x1 = real(z1); y1 = imag(z1);
maxsteps=300; 
horisontal=500; vertical = 500;   %size
stepx = (x1-x0)/horisontal;          %all the real X axis is divided by the size
stepy = (y1-y0)/vertical;            %all imaginary axis divide by size(500) "to gain the step"
[X,Y] = meshgrid(x0:stepx:x1, y0:stepy:y1); % plots from x0(y0) to x1(y1) with step dx(dy)
z = X + Y*i;
c = c*ones(size(z));
picturesq = 0;
for k=1:maxsteps
lols = find(abs(z)>=2); %find elements dif from 0
picturesq(lols) = k*ones(size(lols));
z(lols) = zeros(size(lols));
c(lols) = zeros(size(lols));
z = z.^2 + c;  % our formula
end;
image(flipud(pict))
axis('image')  % makes it perfect square
axis('xy')     % makes numbers to go from 0 to 500 on y-axis, not from y to x
%axis('off')   % delete the things wriiten on x and y axis(numbers written on them)
%colormap(jet(maxsteps))
%colormap(hsv(maxsteps))
%colormap(hot(maxsteps))
%colormap(cool(maxsteps))
%colormap(summer(maxsteps))
%colormap(gray(maxsteps))
1.2 KB in 2 ms with coderay