Why will this script not plot data in the figure? Is there a setting I'm missing? Every time I run the script, all I get is a completely blank (white) graph in the figure.
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
NC_Mark
el 25 de Oct. de 2017
Comentada: Rena Berman
el 31 de Oct. de 2017
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)
hold on
end
5 comentarios
Respuesta aceptada
Greg
el 25 de Oct. de 2017
Editada: Greg
el 25 de Oct. de 2017
The default behavior of plot does not include a marker. This means all you can see is the interpolated line connecting each PAIR of points. When you plot scalar x and y, there's no second point to draw a line to.
Try:
plot(x,y,'.');
To use a dot marker. Search documentation for other marker options if you don't like the dot.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Creating, Deleting, and Querying Graphics Objects en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!