my code won't run or publish

2 Ansichten (letzte 30 Tage)
Raul Flores
Raul Flores am 6 Jun. 2020
Kommentiert: Raul Flores am 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

Antworten (1)

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

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by