How do I make a high quality mandelbrot set?

15 次查看(过去 30 天)
I've managed to create a good-quality version of the mandelbrotset. But i'd like to go deeper, this is what i have thusfar:
clc
clear
close all
detail = 3201; %level of detail you want
a = linspace(-1.6,1.6,detail); %imaginary axis
b = linspace(-2,1.2,detail); %real axis
B = zeros(detail,detail,3); %for color mapping (have plans with the 3 colors later)
% look at "the dark side of the mandelbrot on youtube
[x,y] = meshgrid(a,b); %to create the complex plane
C = y+x*i; %creating the plane
X = C; %initial conditions (first iteration)
for n = 1:63 %iterating
X = X.^2 + C; %calculating
expl = find(abs(X)>2==1); %finding exploded values
X(expl) = 0; %removing from iteration
C(expl) = 0; %removing from plane
B(expl) = n; %saving step value
end
B = B/max(max(max(B))); %deviding by max value for correct color
image(B) %printing
but when trying:
detail = 0.0001;
I run out of memory, i want to make it higher quality, I've thought about cutting it up and rendering smaller parts, but don't know how to connect multiple images without needing a massive array/color map (B in my case).
I haven't found anyone creating higher quality fractals, how can i improve?
Best regards, Mathieu
  1 个评论
Sudarshan Kolar
Sudarshan Kolar 2017-2-28
You are using 'detail' with linspace. linspace(-1.6,1.6,0.0001) will try to make 0.0001 elements between -1.6 and +1.6 and will create empty 'a' and 'b'. I think you should put
detail = 10000;

请先登录,再进行评论。

回答(1 个)

abd abd1
abd abd1 2019-9-13
hi..... here is my code in MATLAB for julia set in complex domain
for ImageWidth = 1:640
for ImageHeight = 1:480
RealPart = (ImageWidth - 320) / 120;
ImaginaryPart = (ImageHeight - 240) / 120;
iteration=0;
c=complex(RealPart,ImaginaryPart);
%z=0+0i;
k=.327+.22i;
z=c;
for i = 1:90
z=z^1.7+k;
if abs(z) > 2 ,break,end
iteration=iteration+1;
ComplexModulusImage(ImageHeight,ImageWidth)=abs(z);
end
IterationImage(ImageHeight,ImageWidth)=iteration;%the number of iteration
end
end
ComplexModulusImage=round(ComplexModulusImage);
image(IterationImage)
colormap(jet)
  1 个评论
darova
darova 2019-9-13
I suggest you to preallocate matrices for better performance
W = 640;
H = 480;
ComplexModulusImage = zeros(H,W);
IterationImage = zeros(H,W);

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Fractals 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by