Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

*Using Octave. I am showing the question and answer for 2 questions but only need help on the second. 1) Play the chaos game of

*Using Octave. I am showing the question and answer for 2 questions but only need help on the second.

1) Play the chaos game of triangles. Create the fractal plot of triangles. Using Point 1 at (0,0), Point 2 at (0.5,1), and Point 3 at (1,0), use the random function to "Roll the Die." Start by picking a random point within the 1, 1 square. (X ranges from 0-1 and Y ranges from 0-1). Roll the die. If the value is a 1 or 2, then move half the distance to Point 1, if 3 or 4, move half the distance to Point 2, if 5 or 6 move half the distance to Point 3.

The rand function generates a value between 0 and 1. You will have to scale it to get values from 0 to 6. Plot only points ('.') in plot function). Use 20,000 points for a nice plot.

~I have done this first part correctly I just need this code modified to follow the second question. Here is my code for question 1.

clf

p1=[0,0];

p2=[0.5,1];

p3=[1,0];

trys=20000;

trys=rand(1,trys)*6;

x=rand(1,1);

y=rand(1,1);

points=[x,y];

plot(x,y,'*r');hold on

axis([0,1,0,1])

for k=1:length(trys)

if(trys(k)<2)

x=x+(p1(1)-x)/2;

y=y+(p1(2)-y)/2;

elseif(trys(k)<4)

x=x+(p2(1)-x)/2;

y=y+(p2(2)-y)/2;

else

x=x+(p3(1)-x)/2;

y=y+(p3(2)-y)/2;

end

%points=[points;x,y];

plot(x,y,'.b');hold on

end

title('Name')

print(gcf,'Chaos.png','-dpng')

~HERE IS MY QUESTION~ THANK YOU :)

2) The 3-D Chaos game. Modify the Chaos game above to be three dimensional to create a pyramid (use an eight sided die).

Use points (x,y,z) of (1, -1/?3, -1/?6) , (-1, -1/?3, -1/?6), (0, 2/?3, -1/?6) , (0,0, -3/?6)

You will have to scale the rand function to get values from 0 to 8. Plot only points ('.') in plot function). Use 20,000 points for a nice plot.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Guide To Client Server Databases

Authors: Joe Salemi

2nd Edition

1562763105, 978-1562763107

More Books

Students also viewed these Databases questions

Question

What do you need to know about your students to motivate them?

Answered: 1 week ago