Accuracy in mandelbrot set
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi all,
I'm trying to write a matlab file which allows me to find nice coordinates in the mandelbrot set (see below). It works fine but if use it to zoom in to much, the images become very pixelated. My guess is that matlab should use more accurate numbers, but i can't seem to manage to solve the problem. You can duplicate my result by running the program below. It will give you the mandelbrot set and a option to click somewhere. It will then zoom in on that point. If you do this 24 times you will clearly see that the image becomes a bit "blurry".
So here is the code:
if true
format long
zoomfactor=4;
middle=-.7;
resolution=100;
startsize=5;
x=gpuArray.linspace(-startsize/2, startsize/2, resolution);
y=gpuArray.linspace(-startsize/2, startsize/2, resolution);
[X,Y]=meshgrid(x,y);
Max=2;
figure(1)
for m=0:inf
iterations=round(zoomfactor^(.12*m)*100);
Z0=(X-1i*Y)*zoomfactor^(-m)+middle;
Z=zeros(size(Z0));
B=gpuArray.zeros(size(Z0));
for n=1:iterations
Z=Z.^2+Z0;
B=B+(abs(Z)<Max);
end
B=log(B);
imagesc(B)
axis off
[a,b]=ginput(1);
m
middle=middle+((a-b*1i)/resolution-1/2+1i/2)*startsize*zoomfactor^(-m)
end
end
Does any of you know a way to solve this problem (without making the program ridiculously slow).
Thanks in advance, Peter
edit: I've done some more searching, and i've found that the error starts occurring at zooms of factor 10^15 (or looking at the 15th decimal). Apparently matlab doesn't compute the decimals beyond this point (this is double precision). Is there any way to get around this? I tried using vpa() but this slowed down my program significantly.
Thanks!
0 Kommentare
Antworten (1)
Zoltán Csáti
am 14 Jan. 2015
Your problem is not with accuracy, but the resolution. Try to increase it. I also have a Mandelbrot viewer and I use 1000x1000 resolution. I don't increase the iteration count since it is not needed unless you look at extremely small scales. Take a look at this page, how to speed up GPU computation.
1 Kommentar
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!