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 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
Greg
il 25 Ott 2017
Modificato: Greg
il 25 Ott 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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Creating, Deleting, and Querying Graphics Objects in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!