Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is my code for matlab for the sierpinski triangle. When I run the code for more than 6 iteration the image looks the same.
This is my code for matlab for the sierpinski triangle.
When I run the code for more than 6 iteration the image looks the same. Why is this?
Also, how can I get my image to be colored?
function sierpinski(A, B, C, iter)
if iter == 0
fill([A(1), B(1), C(1)], [A(2), B(2), C(2)], [0.5,0.5,0.5]);
hold on
else
sierpinski (A,(A+B)/2, (A+C)/2, iter-1);
sierpinski (B,(B+A)/2, (B+C)/2, iter-1);
sierpinski (C,(C+A)/2, (C+B)/2, iter-1);
end
>> sierpinski ([0,1], [100,10],[90,1],10)
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