Scatter() working but not Plot()
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Kateri Kaminski
am 1 Nov. 2018
Kommentiert: Kateri Kaminski
am 5 Nov. 2018
Hello,
I am having trouble getting plot() to work. My code works if I use scatter() instead of plot(). If I used plot(), then I get Error in plot(x,y). Can someone please tell me why plot is not working? Thanks!
x = 1:10;
y = x.^2;
figure
hold on
plot(x,y)
hold off
6 Kommentare
Akzeptierte Antwort
madhan ravi
am 2 Nov. 2018
Bearbeitet: madhan ravi
am 2 Nov. 2018
Delete another .m file which has the same name plot.m or rename it
9 Kommentare
Stephen23
am 3 Nov. 2018
"That makes sense. Do you know why scatter() works then? This loop is the first time I am using plot() so I am not sure why that would be any different than scatter()."
Because you created a variable named plot, but did not create a variable named scatter.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Scatter Plots 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!