my code won't run or publish
2 views (last 30 days)
Show older comments
m = 2;
n = 1;
hold on
for i = 1:100000
q = 3*rand(1);
if q < 1
m = m/2;
n = n/2;
elseif q < 2
m = m/2;
n = (300+n)/2;
else
m = (300+m)/2;
n = (300+n)/2;
end
plot(m,n,'b')
end
hold off
0 Comments
Answers (1)
David Hill
on 6 Jun 2020
m = 2;
n = 1;
for i = 1:100000
q = 3*rand(1);
if q < 1
m = m/2;
n = n/2;
elseif q < 2
m = m/2;
n = (300+n)/2;
else
m = (300+m)/2;
n = (300+n)/2;
end
mm(i)=m;
nn(i)=n;
end
scatter(mm,nn,'filled','MarkerFaceColor','b','SizeData',1);
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!