my code won't run or publish

2 visualizaciones (últimos 30 días)
Raul Flores
Raul Flores el 6 de Jun. de 2020
Comentada: Raul Flores el 6 de Jun. de 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

Respuestas (1)

David Hill
David Hill el 6 de Jun. de 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);

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by