The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
2) A fractal is a curve or geometric figure comprised of a pattern that repeats at every scale. One approach to generating a fractal is called a chaos game. A chaos game is an algorithm in which points are plotted iteratively according to small set of rules. After a sufficient number of points are plotted, a pattern emerges.
A section of the boundary of the Dragon Curve fractal can be plotted in MATLAB using the chaos game approach by plotting points iteratively according to one of the following three rules that are selected randomly with equal probability. (You will need to look up the randi function.)
Rule 1: x n+1 = (xn-yn)/4 −1/2 , y n+1 = (xn+yn)/4 +1
Rule 2: x n+1 = (yn-xn)/4 +1/2 , y n+1 = -(xn+yn)/4 +1
Rule 3: x n+1 = (xn+yn)/2 +1 , yn+1 = (yn-xn)/2
Write a MATLAB script that calculates the x and y vectors, then plots x vs y using plot(x,y,’.r’). Start with x1 = 0 and y1 = 1. Perform 50000 iterations.
Hint 1: At each iteration you’ll calculate a new x and y from the old x and y. Which rule you use to calculate the new x and y is determined by “flipping a coin” (randi). This coin flip happens every iteration.
Attachments: