Reference no: EM132635821
ENGGEN 131 Introduction to Engineering Computation and Software Development - University of Auckland
Fractal Generation: animating Julia sets
This project requires you to write code that will allow you to create fractal images, which will then be combined to produce an animation. Fractals are remarkably beautiful geometric figures, where similar patterns recur as you zoom further and further in on parts of the figure. They occur in nature (e.g. ferns, snowflakes and coast lines) but can also be mathematically generated. Investigating fractals is part of a branch of mathematics known as chaos theory, where very complicated behaviour can be generated from surprisingly simple rules (and changing the starting value just a little can have a huge impact on what happens).
The fractals we will be generating are known as Julia sets. They are named after the French mathematician Gaston Julia, who came up with the formula that generates the sets. Each complex number has a Julia set associated with it. As we will see, while generating a Julia set is relatively straight forward, the Julia sets associated with different complex numbers can look startlingly different. If we traverse a path from one complex number to another and generate a fractal for each step that we take along the path, the resulting sequence of images can be combined to produce an animation.
You have been provided with a main script (AnimateJulia.m) and a few useful helper functions that take care of turning a sequence of images into animated gifs and mp4 files (MakeAnimatedGif.m and MakeMovie.m). In the pages that follow are detailed explanations of each of the eight functions that you need to write to fill in the gaps. On completion of the project you will have written code that allows you to generate Julia sets for a sequence of complex numbers and colour them with a colour map of your own creation (note that the cover image fractals were generated using Matlab's built-in hot colormap called whereas the images below were created using custom colour maps.
This document shows a few example calls for each function with, but it is expected that you will create your own test values to test your code (in many cases you can work out the answers on some very small sets of test data by hand, so that you know what you should expect as output).
A few days prior to the submission date you will be supplied with some test data and test scripts which can be used to help check your code. If your code fails some of the supplied test code there is obviously work to be done. If your code passes the supplied test scripts it is a good sign you are on the right track, but please note that the supplied test code isn't identical to that used to mark your code. If you rely just on the supplied test code (without doing tests of your own) you will run the very real risk of submitting code that will not pass all the marking tests. Do NOT rely solely on the supplied test scripts, part of doing the project is to learn how to extensively test your own code on a range of different values (which is why the supplied test scripts are only released towards the end of the timeline).
This project is designed to take the average student around 15 hours to code, but some people may find it takes upwards of 60 hours (and others will finish it in just a few hours). You will not know ahead of time how long it will take you, so please don't leave it to the last minute to make a start!
Function
CreateComplexGrid
IterateComplexQuadratic
JuliaSetPoints
ColourJulia
GenerateJuliaSets
ReadColourValues
LookupColourValues
CreateColourmap
All functions except IterateComplexQuadratic are called directly from the supplied main script file named AnimateJulia.m.
IterateComplexQuadratic is a great warm up function and is likely to be a useful helper function for when you when you write your JuliaSetPoints function. Even if you decide not to call your IterateComplexQuadratic function from your JuliaSetPoints function you should still write it, as it will be marked.
You will need to implement CreateComplexGrid, JuliaSetPoints, ColourJulia and GenerateJuliaSets before being able to use the supplied script file to generate animated fractals. To use custom colour maps to colour your fractals you will also need to implement ReadColourValues, LookupColourValues and CreateColourmap.
The pages following have detailed specifications of what each function should do. Note that while the functions are designed to work together with the supplied main script (to allow the creation of animated fractals in a colour map of your choice), many of the functions can be written and tested in isolation. Even if you get stuck on one function you should still try and write the others.
Keep the following general principles in mind:
• Note the capital letters used in function names. Case matters in Matlab and you should take care that your function names EXACTLY match those in the projection specification. E.g. if the function name is specified as CreateColourmap don't use the name CreateColormap, createcolourmap, Create_Colourmap or CreateColourMap.
• The order type and dimension of input arguments matters. Make sure you have the required number of inputs in the correct order. E.g. if a function requires 2 inputs, as ColourJulia does (where the first input is a 2D array of values for points in the Julia set and the second input is a 2D array containing a colour map) then the order matters (i.e. the first input should be the array of points not the colour map, to match the specifications). The number of inputs also matters (so don't change a function that requires 2 inputs to require more inputs).
• The order, type and dimensions of the outputs matter, e.g. ReadColourValues returns two outputs, the first of which is a cell array (where each element contains a colour name, stored as a string), then the second element is a 2D array of colour values (with each row containing the colour values for the named colour from the corresponding row of the first array). Muddling up the order or returning the wrong type of array would lose you all the marks for this function.
Attachment:- Matlab Project.rar