Download presentation
1
Mandelbrot Set Fractal
ECE 448: Spring 2015 Lab 5 Mandelbrot Set Fractal
2
Introduction to Lab5 2
3
Benoit Mandelbrot Mandelbrot was born in Poland in 1924.
Father of fractal geometry. He showed how fractals can occur in many different places in both mathematics and elsewhere in nature.
4
What is a Fractal? Fractals are mathematical structures defined by two properties Iterative Self-similar Zooming in or out on the image reveals deep repetition of patterns
5
The Mandelbrot Set The Mandelbrot set is a set of points in the complex plane, the boundary of which forms a fractal. Mathematically, the Mandelbrot set can be generated using a very simple iterative formula, called the quadratic recurrence equation, applied to points in complex plane zn+1 = zn2 + c That is, a complex number c, is in the Mandelbrot set if the absolute value of zn never exceeds a certain number. we start with z0=0 and apply the iteration repeatedly, The absolute number depends on c, however large n gets.
6
The Mandelbrot Set
7
Pseudocode In the pseudocode below, c=cx+i·cy, corresponds to one pixel of the display region. The plotted region should have the following limits -2 ≤ cx=Re[c] ≤ 1 -1 ≤ cy=Im[c] ≤ 1 for cy = -1 to 1, step 2/400 do for cx = -2 to 1, step 3/600 do { zx = 0 zy = 0 iteration = 0 z and c are complex numbers. One begins by assigning a fixed value to c, letting z = 0 and calculating the output. One then repeatedly recalculates, or iterates, the equation, substituting each new output for z. Some values of c, when plugged into this iterative function, produce outputs that swiftly soar toward infinity. Other values of c produce outputs that eternally skitter about within a certain boundary. This latter group of c‘s, or complex numbers, constitutes the Mandelbrot set.
8
Pseudocode Cont… // z = z2 + c = // =(zx2 – zy2 + cx) + i · (2 · zx · zy + cy) while (zx2 + zy2 < 4 && iteration < MAX_ITER ){ zxtemp = zx2 – zy2 + cx zytemp = 2 · zx · zy + cy zx = zxtemp zy = zytemp iteration++ }
9
Pseudocode Cont… x = x_conv(cx) // conversion to the x-coordinate of a pixel y = y_conv(cy) // conversion to the y-coordinate of a pixel if zx2 + zy2 < 4 color(x,y) = fractal_color else color(x,y) = background_color }
10
x_conv() and y_conv The functions x_conv() and y_conv() are used to convert the coordinates of the complex number c into x and y coordinates of the pixel. x = x_conv(cx) = 20 + (cx-(-2))*(600/3) = *(cx+2) y = y_conv(cy) = 440 – (cy-(-1))*(400/2) = *(cy+1)
11
The magnification of the last image relative to the first one is about 10,000,000,000 to 1.
12
Fixed Point Representation
You can use Q4.28 representation 4 integer bits 28 fractional bits Addition/Subtraction performed as usual Multiplication of two Q4.28 numbers results in a Q8.56 number, which should be converted back to Q4.28
13
VGA Display Area Use a rectangular area of the size (600 x 400) to display the Mandelbrot set fractal. Left and Right border = 20 pixels each Top and Bottom border = 40 pixels each
14
Cont.. Top border should display “The Mandelbrot Set” in the center.
Bottom border should display Percentage of the display area, increasing every 0.5%. Progress bar Total execution time with the step 0.1 s.
15
Input/Output Scheme Use BTNS as the Start/Pause button to start/pause the computations. The color of the fractal and background should also change, depending on the positions of switches
16
Final VGA Display Outlook
THE MANDELBROT SET 33.1 s 95.5%
17
Bonus Tasks color = iteration mod 8
Increase the speed of calculations, by evaluating 4 values of c in parallel. Determine the maximum speed-up possible by evaluating N values of c in parallel, where N is limited only by the available FPGA resources. Add colors by assigning a different color to each value of c, based on the number of iterations required for the decision based on the following formula: color = iteration mod 8
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.