Plot a 2D ,with accordance to the distance between the points

5 ビュー (過去 30 日間)
RASHMI PRASAD
RASHMI PRASAD 2020 年 12 月 15 日
コメント済み: RASHMI PRASAD 2020 年 12 月 15 日
I have two array and distance between the corresponding points are known, I wish to plot the points such that it is arranged in accordance with the distance between them.
Please help me in this regard.
  2 件のコメント
KSSV
KSSV 2020 年 12 月 15 日
USe plot.
RASHMI PRASAD
RASHMI PRASAD 2020 年 12 月 15 日
I have used plot but it wouldn't work in my case, let me explain my question:
Please consider this case:
%node1 node2 distance between nodes
A=[1.0000 2.0000 334
1.0000 39.0000 219
2.0000 3.0000 123
2.0000 25.0000 102
2.0000 30.0000 181
3.0000 4.0000 153
3.0000 18.0000 106
4.0000 5.0000 094
4.0000 14.0000 088
5.0000 8.0000 065
6.0000 5.0000 023
6.0000 7.0000 061
6.0000 11.0000 069
7.0000 8.0000 038
8.0000 9.0000 301
9.0000 39.0000 219
10.0000 11.0000 038];
I have to plot in a way that nodes having smaller distance are closer and larger distance are far.

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

採用された回答

Hiro Yoshino
Hiro Yoshino 2020 年 12 月 15 日
I hope I can give you some guide:
s = A(:,1);
t = A(:,2);
weight = A(:,3);
G = graph(s,t,weight);
plot(G, 'EdgeLabel', G.Edges.Weight);
You should take a look at "graph" in the documentation.

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by