draw line graphs connecting two points

1 回表示 (過去 30 日間)
HYZ
HYZ 2021 年 7 月 24 日
編集済み: Chunru 2021 年 7 月 24 日
Hi,
I want to draw somthing like this. Can I know how to connect two points? thanks.

回答 (1 件)

Chunru
Chunru 2021 年 7 月 24 日
編集済み: Chunru 2021 年 7 月 24 日
% Fisrt specify the coordinates
pstart = [ones(1,5); (1:5)]
pstart = 2×5
1 1 1 1 1 1 2 3 4 5
pend = [ones(1,5)+5; (1:5)+9]
pend = 2×5
6 6 6 6 6 10 11 12 13 14
% plot the lines
plot([pstart(1,:); pend(1,:)], [pstart(2,:); pend(2,:)])

カテゴリ

Help Center および File ExchangeGraph and Network Algorithms についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by