Question
For Matlab Assume you have three points at the corner of an equilateral triangle, P1 = (0,0), P2 = (0.5,2/2), and P3 = (1,0). Now
For Matlab
Assume you have three points at the corner of an equilateral triangle, P1 = (0,0), P2 = (0.5,2/2), and P3 = (1,0). Now you want to generate another set of points pi = (xi, yi) such that p1 = (0,0) and pi+1 is the midpoint between pi and P1 with 33% probability, the midpoint between pi and P2 with 33% probability, and the midpoint between pi and P3 with 33% probability. Write a function with header [ ] = mySierpinski (n) that generates the points pi for i = 1,,n. The function should make a plot of the points using blue dots (i.e., 'b.' as the third argument to the plot command).
Test Cases:
>>mySierpinski(100)
Try your function for n = 10,000
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started