Execute this script and be amazed by the results! You can try more points to get a clearer picture, but it may take a while to run
belongs to book: MATLAB: A Practical Introduction to Programming and Problem Solving|Stormy Attaway|Fourth Edition| Chapter number:5| Question number:11.5
All Answers
total answers (1)
Ch5Ex11.m
clear
clf
x = rand;
y = rand;
plot(x,y)
hold on
for it = 1:10000
choic = round(rand*2);
if choic == 0
x = x/2;
y = y/2;
elseif choic == 1
x = (x+1)/2;
y = y/2;
else
x = (x+0.5)/2;
y = (y+1)/2;
end
plot(x,y,’r*’)
hold on
end
need an explanation for this answer? contact us directly to get an explanation for this answer