Problem 1 The Sierpinski triangle can be implemented in MATLAB by plotting point
ID: 3699172 • Letter: P
Question
Problem 1 The Sierpinski triangle can be implemented in MATLAB by plotting points iteratively according to one of the following three rules which are selected randomly with equal probability. Rule1: ?? =0.5?? , ?? =0.5?? Rule 2: Rule 3: ??+1 ?? ??+1 ?? ?? = 0.5?? + 0.25 , ?? = 0.5?? + ?3 ??+1 ?? ??+1 ?? 4 ?? = 0.5?? + 0.5 , ?? = 0.5?? ??+1 ?? ??+1 ?? Write a program in a script file that calculates the ?? and ?? vectors and then plots ?? versus ?? as individual points (use plot(x,y,‘^’) ). Start with ??1 = 0 and ??1 = 0. Run the program four times with 10, 100, 1,000, and 10,000 iterations. Present the graphs for 10, 100, 1,000, and 10,000 iterations. For 10,000 iterations, the graph will look a bit like the one shown above.This written work is my code. It says something is wrong with the randi because I didn’t use integers. Please help me thank you Problem 1 The Sierpinski triangle can be implemented in MATLAB by plotting points iteratively according to one of the following three rules.r which are selected randomly with equal probability 0.7 05 Rule 2: xn0.5x 0.255y 01 Rule 3: Xn+1 0.5xn 0.5, yn+1 -0.5n Write a program in a script filethat calculates the x and y vectors and then plots y versus .x as individual points (use plotx,y.). Start with x0 and y10. Run the program four times with 10, 100, 1,000, and 10,000 iterations. Present the graphs for 10, 100, 1,000, and 10,000 iterations. For 10,000 iterations, the graph will look a bit like the one shown above
Explanation / Answer
just replace line 5 in your code with the following:
rule = randi(3)
And you'll get it working.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.