Interactive fractal viewer for the Mandelbrot and Julia sets

Mandelbrot and Julia set viewer with C subfunction with up to 1E10x zoom with pan enabled.
1.5K Downloads
Updated 5 May 2011

View License

The Mandelbrot set is a set of complex numbers C where z_n+1 = z_n^2 + c (z_0 = 0) does not diverge for all c in the set C. The image is generated by calculating the number of iterations until |z_n| is larger than a certain escape radius. Of course, since some points will never diverge, a limit of the number of iterations is required.

The function used for the Julia set is the simple monic quadratic function. This Julia set is similar to the Mandelbrot set in that it uses a similar form. But, this time, it is the set of complex numbers C where z_n+1 = z_n^2 + d does not diverge for all c in the set C given that z_0 = c. The variable d is constant and complex.

To plot the sets, the viewer uses a set of datapoint as c in the Mandelbrot set case, or z_0 in the Julia set case, and generates a color for each datapoint that depends on the number of iterations needed for divergence.

With this code, you can zoom in up to 1E10x and out, and pan around as if viewing a regular plot. After each zoom or pan action, the set is recalculated given the new plot boundaries view using a C subfunction (a matlab subfunction is also provided).

To view the Mandelbrot using default settings, simply run main(). For the Julia set, use main('FractalType','Julia').

The function main also accepts other Parameter-Value pairs. For the list of all properties, see the function header.

Future additions include adding a GUI to change the maximum number of iterations.

Cite As

Christopher (2024). Interactive fractal viewer for the Mandelbrot and Julia sets (https://www.mathworks.com/matlabcentral/fileexchange/29118-interactive-fractal-viewer-for-the-mandelbrot-and-julia-sets), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2009a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Fractals in Help Center and MATLAB Answers
Acknowledgements

Inspired by: Mandelbrot set vectorized

Community Treasure Hunt

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

Start Hunting!

fractalv03/

Version Published Release Notes
1.4.0.0

Added missing "const" to function argument.

1.3.0.0

Added Julia sets and inputParser.

1.2.0.0

Added Julia sets and inputParser.

1.1.0.0

Updated input parameter checking. Added more comments. Improved image cache system.

1.0.0.0