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.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
NC_Mark
am 25 Okt. 2017
Kommentiert: Rena Berman
am 31 Okt. 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 Kommentare
Akzeptierte Antwort
Greg
am 25 Okt. 2017
Bearbeitet: Greg
am 25 Okt. 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!