How to draw and connect three points
21 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Give three matrices with one row and two columns (1x2). Each matrix corresponds to a point and the two columns of each matrix correspond to the x y coordinates of the respective point. So I have three points in total. How can I draw these three points on a graph, link them through segments and label them?
Antworten (3)
KSSV
am 19 Mär. 2019
x = rand(1,3) ;
y = rand(1,3) ;
plot(x,y) ;
n = 1:3 ;
text(x,y,num2str(n'))
0 Kommentare
Star Strider
am 19 Mär. 2019
Try this:
V1 = randi(9, 1, 2); % Vector #1
V2 = randi(9, 1, 2); % Vector #2
V3 = randi(9, 1, 2); % Vector #3
M = [V1; V2; V3; V1]; % Repeat First Row To Complete The Triangle
figure
plot(M(:,1), M(:,2))
axis([0 10 0 10])
ptl = sprintfc('V_{%d}', 1:3); % Numbered Vectors
ptl = sprintfc('V(%.1f,%.1f)', M(1:end-1,:)); % Vector Coordinates
text(M(1:end-1,1), M(1:end-1,2), ptl)
Experiment to get the result you want.
0 Kommentare
Siehe auch
Kategorien
Mehr zu ANOVA 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!