Fractals

In this lab we will explore the popular fractal images, relating them to what we know about equilibrium and stability.ccollins@math.utk.eduThere are 6 MATLAB functions we will use. 1. 1D ChaosThe first function is chaos.m which is a function which explores the behavior of the difference equationx(n+1) = a x(n) (1-x(n))for a range of a values. To use, save the file in theworkfolder and then in MATLAB typechaos(0,4)The two numbers (0 and 4 in this case), specify the range of a values.2. 2D Fractals - Quadratic MapThe popular fractal images (Mandelbrot and Julia Sets) are based on a simple quadratic difference equation (or quadratic map):z(n+1) = z(n)This is really a^{2}+ csystemof difference equations asz(n)andcare complex numbers. If we letz(n) = x(n) + i y(n)andc = a + i b, then this system isx(n+1) = x(n)This system has equilibrium values, but they are not all stable, and even if they are stable, not all starting values will reach them. To perform some iterations with this system, we need to specify^{2}- y(n)^{2}+ a y(n+1) = 2 x(n) y(n) + bcand a starting valuez(0). quadmap.m is a MATLAB script which prompts you for a value forcandz(0)and then plots 30 values ofz(n). To enter complex numbers in MATLAB, write them at 2.5 + 0.3*i. Save this script and run it with different values ofcandz(0).3. Julia SetsFor each value ofcthere is a Julia set. The Filled Julia Set is the set of allz(0)such that the valuesz(n)stay bounded. To create the set we take starting values in the box [-2,2]x[-2,2] and for each one we iterate until either we leave the box, or we reach the limit on the number of iterations. If we reach the limit, we say the point is in the set (and draw) it. There are two versions of the Julia Set program, one does b/w and the other does color, using the number of iterations to leave the box as the pointer to the color map. julia.m - b/w filled julia set julia2.m - color filled julia set Both are functions and are called by eitherjulia(c,m)orjulia(c,m,xrange,yrange)where the first instance uses the ranges [-2,2] and [-2,2],mis the number of points to divide the ranges into. To specify a range, use [lower,upper]. Trym = 50to start. It might take to long to compute with largerm. Here's some values forcyou might try: -1.5 + 0.2i -0.1 + 0.75i -0.4 + 0.8i 0.28 + 0.53i -0.11 + 0.86i -1.32 0.48 + 0.48i 1.5i -0.5 + 0.57i -0.4 + 0.4i4. Mandelbrot SetThere is only one Mandelbrot Set. It is the set of allcvalues, so that starting withz(0) = 0, the valuesz(n)remain bounded. The calculation is the same as for the Julia Set, except thatcis taken from some range andz(0)is fixed. There are two functions for the Mandelbrot Set: b/w and color: mandel.m - b/w mandelbrot set mandel2.m - color mandelbrot set Both are functions and are used by typingmandel(m)ormandel(m,xrange,yrange)wheremis the number of points to use in each direction and the range is either the default [-2,2] or as specified. Again, try small values ofmfirst to see how long it takes.5. Useful InformationIf you want to print out a graph, you can just choose print from the file menu. (It will come out in b/w). If you want to save a graph as a jpeg to put on your webpage, typeaxis offprint -djpegIf you want another type of file, useyour_filename.jpghelp printto get the options.