How to draw and connect three points

43 ビュー (過去 30 日間)
Guido Pastore
Guido Pastore 2019 年 3 月 19 日
回答済み: Star Strider 2019 年 3 月 19 日
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?
  1 件のコメント
Rik
Rik 2019 年 3 月 19 日
What have you tried so far?

サインインしてコメントする。

回答 (3 件)

KSSV
KSSV 2019 年 3 月 19 日
x = rand(1,3) ;
y = rand(1,3) ;
plot(x,y) ;
n = 1:3 ;
text(x,y,num2str(n'))

Guido Pastore
Guido Pastore 2019 年 3 月 19 日
Head = [HeadX HeadY HeadZ];
Head_1 = Head(1,1:2);
HeadX_1 = 250.8390;
HeadY_1 = 643.3690;
scatter(HeadX_1, HeadY_1);
LRCollar = [LRCollarX LRCollarY LRCollarZ];
LRCollar_1 = LRCollar(1,1:2);
LRCollarX_1 = 264.4240;
LRCollarY_1 = 341.0450;
scatter(LRCollarX_1, LRCollarY_1);
Waist = [WaistX WaistY WaistZ];
Waist_1 = Waist(1,1:2);
WaistX_1 = 281.9030;
WaistY_1 = -94.8090;
scatter(WaistX_1, WaistY_1);
untitled.jpg

Star Strider
Star Strider 2019 年 3 月 19 日
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.

カテゴリ

Help Center および File ExchangeMap Display についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by