my code won't run or publish

2 views (last 30 days)
Raul Flores
Raul Flores on 6 Jun 2020
Commented: Raul Flores on 6 Jun 2020
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

Answers (1)

David Hill
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);

Categories

Find more on MATLAB in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!