# Mandelbrot set matlab

1. Nov 22, 2011

### gausshi

Hi!

The Mandelbrot set is defined as a fractal set of points c of the plan for which the sequence defined recursively by:
Zn+1 = Zn.^2c

with z 0 = 0

does not tend towards infinity (in module).

useful property
If there exists an integer N such that | zN |> 2, then the sequence diverges.
graphical representation
In practice we set a maximum number M of iterations. If the module does not exceed the value
2 after M iterations, we consider that the sequence converges and that c belongs to
the Mandelbrot set.
For purely aesthetic reasons, the Mandelbrot set is often represented with
of colors. Color (black in the example above) is assigned to points belonging
to all. Then, the color depends on the number of iterations needed for the following
be considered divergent (In practice, this is the number of iterations required for the
module exceeds z 2).

1) Create the function converges, which takes as input a complex vector c and the integer M
representing the maximum number of iterations to be tested.
This function returns an output vector containing for each element of the vector c
the number of iterations before which later was determined divergent.
It is conceivable that the vector contains a particular number in cases where more has not been determined divergent (we assume when it is convergent).

function V=converge(c,M)

for j=1:l
k=0;
for i=1:(M)
z(1)=0;
z(i+1)=z(i)^2+c(1,j);

abs(z(i+1));

if(abs(z(i+1))<=2)
k=k+1;
else
V(1,j)=k;
break
end
V(1,j)=k;
end
end

2) Create the script affiche_mandelbrot makes the display (in color) of the full Mandelbrot set
(do some research to find the appropriate limits of the axes).
Find a color palette, a number M and a satisfactory resolution so that the general shape is visible
but the display is not too long. Try several values ​​of M to see the differences.
How do you explain?

I need help !

4) Modify the script affiche_mandelbrot so it asks the user a point and it zooms around this point
(the intensity of the zoom can also be set by the user).
To do this, you can use the input of Octave / Matlab.