Clear Filters
Clear Filters

How do I make a high quality mandelbrot set?

17 views (last 30 days)
Mathieu Nass
Mathieu Nass on 19 Feb 2017
Commented: darova on 13 Sep 2019
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 Comment
Sudarshan Kolar
Sudarshan Kolar on 28 Feb 2017
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;

Sign in to comment.

Answers (1)

abd abd1
abd abd1 on 13 Sep 2019
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 Comment
darova
darova on 13 Sep 2019
I suggest you to preallocate matrices for better performance
W = 640;
H = 480;
ComplexModulusImage = zeros(H,W);
IterationImage = zeros(H,W);

Sign in to comment.

Categories

Find more on Fractals in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!