Attachment 'mandelbrot.m'
Download 1 %
2 % Filename: mandelbrot.m
3 %
4 function [m]=mandelbrot(edge,x1,x2,y1,y2)
5 maxloop=64;
6 maxsize=16;
7 if edge<1
8 edge=10;
9 end
10 m=zeros(edge);
11 ystep=(y2-y1)/edge;
12 xstep=(x2-x1)/edge;
13 iy=1;
14 for y=y1:ystep:y2
15 ix=1;
16 for x=x1:xstep:x2
17 mx=x;
18 my=y;
19 for i=1:maxloop
20 realnum=mx*mx;
21 imagnum=my*my;
22 if(realnum+imagnum)>maxsize
23 break
24 end
25 my=(mx*my)+y;
26 mx=(realnum-imagnum)*.5 +x;
27 end
28 m(iy,ix)=maxloop-i;
29 ix=ix+1;
30 end
31 iy=iy+1;
32 end
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.You are not allowed to attach a file to this page.