16
Computation and Simulation EE317 2008-2009 Assignment One Group 6 : Group 6 : Student Name: Student Name: Student Number Student Number Cong Chen Cong Chen 55751683 55751683 Shane Conaty Shane Conaty 55372585 55372585 John Maguire John Maguire 55438683 55438683

Computation and Simulation EE317 2008-2009 Assignment One

Embed Size (px)

DESCRIPTION

Computation and Simulation EE317 2008-2009 Assignment One. Group 6 : Student Name: Student Number Cong Chen 55751683 Shane Conaty 55372585 John Maguire 55438683. WHAT IS A FRACTAL ?. - PowerPoint PPT Presentation

Citation preview

Page 1: Computation and Simulation EE317 2008-2009 Assignment One

Computation and Simulation EE317

2008-2009Assignment One

Group 6 :Group 6 :Student Name: Student Student Name: Student NumberNumber

Cong Chen Cong Chen 55751683 55751683

Shane ConatyShane Conaty 55372585 55372585

John Maguire John Maguire 55438683 55438683

Page 2: Computation and Simulation EE317 2008-2009 Assignment One

WHAT IS A FRACTAL ?WHAT IS A FRACTAL ?

A fractal is generally "a rough or A fractal is generally "a rough or fragmented geometric shape that can be fragmented geometric shape that can be split into parts, each of which is (at least split into parts, each of which is (at least approximately) a reduced-size copy of the approximately) a reduced-size copy of the whole, a property called self-similarity.whole, a property called self-similarity.

The word The word ‘‘fractalfractal’’ was derived from the was derived from the Latin ‘fractus’ meaning "broken" or Latin ‘fractus’ meaning "broken" or "fractured by Benoît Mandelbrot in 1975."fractured by Benoît Mandelbrot in 1975.

A mathematical fractal is based on an A mathematical fractal is based on an equation that undergoes iteration, a form equation that undergoes iteration, a form of feedback based on recursion.of feedback based on recursion.

The Mandelbrot set is a famous example of The Mandelbrot set is a famous example of a fractal.a fractal.

Page 3: Computation and Simulation EE317 2008-2009 Assignment One

OCCURRENCE AND USE OF OCCURRENCE AND USE OF FRACTAL IN LIFEFRACTAL IN LIFE

First the study of First the study of ‘fractal’ has create a ‘fractal’ has create a generation of various generation of various arts form.arts form.

Images of fractals can bImages of fractals can be created using fractal ge created using fractal generating software.enerating software.

‘‘Fractal Art contest’ Fractal Art contest’ has taken place every yehas taken place every years.ars.

Fractal music is also Fractal music is also popular world wide.popular world wide.

Page 4: Computation and Simulation EE317 2008-2009 Assignment One

OCCURRENCE AND USE OF OCCURRENCE AND USE OF FRACTAL IN GAMINGFRACTAL IN GAMING

Fractals are often Fractals are often used in Gaming used in Gaming industry for making industry for making backgrounds and backgrounds and creating CG creating CG animationsanimations

One very famous One very famous example is the example is the CG animation in CG animation in series of ‘series of ‘Final Final Fantasy’Fantasy’

Page 5: Computation and Simulation EE317 2008-2009 Assignment One

OCCURRENCE AND USE OF OCCURRENCE AND USE OF FRACTAL IN ENGINEERINGFRACTAL IN ENGINEERING

Fractals are often Fractals are often used in ‘used in ‘Fracture Fracture MechanicMechanic’.’. Fracture mechanics is the fiFracture mechanics is the fi

eld of mechanics concerneeld of mechanics concerned with the study of the formd with the study of the formation of cracks in materials. ation of cracks in materials.

It uses methods of analyticaIt uses methods of analytical solid mechanics to calculal solid mechanics to calculate the driving force on a crate the driving force on a crack and those of experimentck and those of experimental solid mechanics to charaal solid mechanics to characterize the material's resistcterize the material's resistance to fracture.ance to fracture.

Page 6: Computation and Simulation EE317 2008-2009 Assignment One

OCCURRENCE AND USE OF OCCURRENCE AND USE OF FRACTAL IN ENGINEERING IIFRACTAL IN ENGINEERING II

Fractal has also been used inFractal has also been used in ‘Rock and Soil ‘Rock and Soil Mechanic’Mechanic’ Fractal dimension will be uFractal dimension will be u

sed to characterize the statsed to characterize the state of rolling bearing failure e of rolling bearing failure in performance under diffein performance under different non-linear behavior.rent non-linear behavior.

The fractal dimension can The fractal dimension can be used as a means of identbe used as a means of identification of the features of rification of the features of rolling bearing failure. olling bearing failure.

Hydropower projectsHydropower projects with with many rocks, soil and concrmany rocks, soil and concrete materials in close contaete materials in close contact, and soil and rocks exist ct, and soil and rocks exist substantial distribution of isubstantial distribution of irregular fissures or pores rregular fissures or pores

Page 7: Computation and Simulation EE317 2008-2009 Assignment One

OCCURRENCE AND USE OF OCCURRENCE AND USE OF NEWTONRAPHSON’S METHOD IN NEWTONRAPHSON’S METHOD IN

ENGINEERING ENGINEERING In numerical analysis, In numerical analysis,

NewtonRaphson methodNewtonRaphson method (named after Isaac Newton (named after Isaac Newton and Joseph Raphson) is and Joseph Raphson) is perhaps the best known perhaps the best known method for finding method for finding successively better successively better approximations to the approximations to the zeroes (or roots)zeroes (or roots) of a real- of a real-valued function. Newton's valued function. Newton's method can often converge method can often converge remarkably quickly, remarkably quickly, especially if the iteration especially if the iteration begins "sufficiently near" begins "sufficiently near" the desired root.the desired root.

Page 8: Computation and Simulation EE317 2008-2009 Assignment One

OCCURRENCE AND USE OF OCCURRENCE AND USE OF NEWTONRAPHSON’S METHOD IN NEWTONRAPHSON’S METHOD IN

ENGINEERINGENGINEERING Newton-Raphson’s method is Newton-Raphson’s method is

used in the used in the application of couapplication of coupling chaos mapping Newton ipling chaos mapping Newton iterative method in terative method in MOTOR SYSMOTOR SYSTEMTEM..

Newton-Raphson’s method Newton-Raphson’s method can also be used to get more acan also be used to get more accurate approximations where ccurate approximations where needed. needed. For example Rocket trajectory For example Rocket trajectory

for space shuttles needs to be for space shuttles needs to be calculated to perfection becaucalculated to perfection because a minor miscalculation herse a minor miscalculation here on earth could mean thousae on earth could mean thousands of miles in the difference nds of miles in the difference from predicted position and afrom predicted position and actual position in space.ctual position in space.

Page 9: Computation and Simulation EE317 2008-2009 Assignment One

DESIGN AND CREATE DESIGN AND CREATE FRACTAL IMAGE BY USING FRACTAL IMAGE BY USING

MATLABMATLAB

Y=X^3 - 1

Page 10: Computation and Simulation EE317 2008-2009 Assignment One

CODINGCODING close all; clear all; real_lower = -5; // create a plane that has valu

e -5 real_upper = 5; // to 5 on x-axis, and -5 to 5 on

the imag_lower = -5; // y- axis imag_upper = 5; N =1000; // initial all the values step_1 = (real_upper - real_lower)/N ; step_2 = 1; Max = 20 ; // the newton-raphson’s method will threshold = 1e-12; // run 20 time, and it has a threshold

//value of 10 to the power of -12 root_values = zeros(N) ;

Page 11: Computation and Simulation EE317 2008-2009 Assignment One

CODINGCODING % define 3 roots% define 3 roots root1 = 1.0 ; root1 = 1.0 ; root2 = -0.5 - i*sqrt(3.0)/2.0 ; root2 = -0.5 - i*sqrt(3.0)/2.0 ; root3 = -0.5 + i*sqrt(3.0)/2.0 ;root3 = -0.5 + i*sqrt(3.0)/2.0 ;

The function p(z) = z3 − 1) has three roots, one real root and two complex roots. There are:

1.0 ;1.0 ; -0.5 - i*sqrt(3.0)/2.0-0.5 - i*sqrt(3.0)/2.0 ;-0.5 + i*sqrt(3.0)/2.0 ;-0.5 + i*sqrt(3.0)/2.0 ;

We need to define them first.

Page 12: Computation and Simulation EE317 2008-2009 Assignment One

CODINGCODING for(ct1 = 1:N) for(ct1 = 1:N) for(ct2 = 1:N)for(ct2 = 1:N) x_old = real_lower + ct2*step_1 + i*(imag_lox_old = real_lower + ct2*step_1 + i*(imag_lo

wer + ct1*step_1) ; wer + ct1*step_1) ; fprintf(1,'x_old equals %f %f \n',real(x_old),imfprintf(1,'x_old equals %f %f \n',real(x_old),im

ag(x_old)) ; ag(x_old)) ; step_2 = 1 ; step_2 = 1 ; while (step_2 < Max)while (step_2 < Max) %fprintf(1,' x guess equals %1.14f \n',x_old);%fprintf(1,' x guess equals %1.14f \n',x_old); y = power (x_old,3) - 1;y = power (x_old,3) - 1; z = 3.0 * power(x_old,2) ;z = 3.0 * power(x_old,2) ; x_new = x_old - y/z;x_new = x_old - y/z; x_old = x_new ;x_old = x_new ; step_2 = step_2 + 1;step_2 = step_2 + 1; endend

// because of we set N equal // because of we set N equal to //1000, that means we to //1000, that means we put //1,000,000 points on put //1,000,000 points on the plane, //the Newton-the plane, //the Newton-raphson’s //method will run raphson’s //method will run through all //these through all //these 1,000,000 points to find //1,000,000 points to find //cocorrespondingrresponding roots roots

// set the initial step equal // set the initial step equal to 1, //and maximum step as to 1, //and maximum step as 20. //That means 20. //That means Newton-//raphson’s method Newton-//raphson’s method will run 20 //times for each will run 20 //times for each points in order //to find the points in order //to find the accurate roots.accurate roots.

// y is the function on it’s // y is the function on it’s ownown

// z is the first derivative of // z is the first derivative of the // original function the // original function

// // x_new = x_old - y/z is the /x_new = x_old - y/z is the // / Newton-raphson’s Newton-raphson’s methodmethod

Page 13: Computation and Simulation EE317 2008-2009 Assignment One

CODINGCODING if( abs(x_new - root1 ) < threshold ) // if the roots we

get is root_values(ct1,ct2) = 0.5; //close to root1, then we end //set it as 0.5. if( abs(x_new - root2 ) < threshold ) // if the roots we get is root_values(ct1,ct2) = 1.5; // close to root1, then we end // set it as 1.5

if( abs(x_new - root3 ) < threshold ) // if the roots we get is root_values(ct1,ct2) = 2.5; // close to root1, then we end // set it as 2.5 end end //end the loop

Page 14: Computation and Simulation EE317 2008-2009 Assignment One

CODINGCODING mymap = [ 1 0 0 ; 0 1 0 ; 0 0 1] ; // set up

my own //color map. Figure

surf(root_values) // the final step is to view([0 90]) // draw the image shading interp // on the screen. colormap(mymap) colorbar

Page 15: Computation and Simulation EE317 2008-2009 Assignment One

THE OTHER TWO IMAGE THE OTHER TWO IMAGE THAT REQUIREDTHAT REQUIRED

This is the fractal This is the fractal image of function image of function Y=X^4 – 1

This is the fractal image of function Y=X^3-2X+2

Page 16: Computation and Simulation EE317 2008-2009 Assignment One

Discuss a specific innovation that you have developed in

completing this assignment.

During the assignment, we can found the program During the assignment, we can found the program that we wrote is not very efficient, because of the that we wrote is not very efficient, because of the method we used was to set up a max value of iteration, method we used was to set up a max value of iteration, 20. The Newton-Raphson’s method will run 20 of time 20. The Newton-Raphson’s method will run 20 of time to find the roots. It took a very long time.to find the roots. It took a very long time.

For improvement, we can put decision loop in to the For improvement, we can put decision loop in to the Newton-Raphson method loop, as soon as the method Newton-Raphson method loop, as soon as the method find the root, then we can decide which root it belongs find the root, then we can decide which root it belongs to, then jump out the loop or trying to find another to, then jump out the loop or trying to find another root.root.