Cody

Problem 81. Mandelbrot Numbers

Created by Cody Team in Community

The Mandelbrot Set is built around a simple iterative equation.

 z(1)   = c
 z(n+1) = z(n)^2 + c

For any complex c, we can continue this iteration until either abs(z(n+1)) > 2 or n == lim, then return the iteration count n.

  • If c = 0 and lim = 3, then z = [0 0 0] and n = 3.
  • If c = 1 and lim = 5, then z = [1 2], and n = length(z) or 2.
  • If c = 0.5 and lim = 5, then z = [0.5000 0.7500 1.0625 1.6289] and n = 4.

For a matrix of complex numbers C, return a corresponding matrix N such that each element of N is the iteration count n for each complex number c in the matrix C, subject to the iteration count limit of lim.

If C = [0 0.5; 1 4] and lim = 5, then N = [5 4; 2 1]

Cleve Moler has a whole chapter on the Mandelbrot set in his book Experiments with MATLAB: Chapter 10, Mandelbrot Set (PDF)

Solution Stats

50.11% Correct | 49.89% Incorrect
Last solution submitted on Mar 19, 2019

Problem Comments

Recent Solvers371

Suggested Problems

More from this Author95

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!