Plotting multiple points in graph
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Adrian Lee
am 11 Nov. 2020
Beantwortet: Alan Stevens
am 11 Nov. 2020
I want to plot multiple points on the graph as shown in the picture
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/410360/image.png)
the code i am currently using is this:
clear
delta = 1; %user editted
%spacing between points
%generated array of points
counter = 1;
for counterx = 1: delta : 10
for countery = 1: delta : 10
xcod(counter) = counterx;
ycod(counter) = countery;
counter = counter+1
end
end
xcod = transpose(xcod);
ycod = transpose(ycod);
figure(1)
%plotting points into graph
plot(xcod,ycod,'.') % points plot
is there a way to plot this graph differently?
I do not want to do it using a 'counter loop' as that will take computing time if i increase the amount of points plotted
note: delta is used in the code because i want the code to be user editted in the final code, it is there as a placeholder while i finish the other parts
0 Kommentare
Akzeptierte Antwort
Alan Stevens
am 11 Nov. 2020
Here is one way
x = 1:10; y = 1:10; [x, y] = meshgrid(x,y);
plot(x,y,'k.')
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Graph and Network Algorithms 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!