フィルターのクリア

How to connect two points with a line

820 ビュー (過去 30 日間)
Yuang
Yuang 2014 年 9 月 24 日
コメント済み: Sindhuja john 2023 年 5 月 26 日
I want to plot a line between two know points in coordinate.
Like I have two points (1,2) and (3,4). I want to connect them with a line segment.
I try line([2,3],[3,4]) and plot([1,2],[3,4]). Both are set x and y limits not connect them.
Can anyone help?
Thank you
  2 件のコメント
k khaja
k khaja 2022 年 3 月 10 日
編集済み: k khaja 2022 年 3 月 10 日
How can we add weight to edge after ploting the above line.
Thanks in advance
Star Strider
Star Strider 2022 年 3 月 10 日
How can we add weight to edge after ploting the above line.
Not sure what that means. Try the 'LineWidth' property to create a thicker line.

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

採用された回答

Star Strider
Star Strider 2014 年 9 月 24 日
You need to plot the x-values in one vector and the y-values in another vector:
plot([1 3], [2 4])
The x-values in your two points are [1 3] and the y-values are [2 4].
  1 件のコメント
Sindhuja john
Sindhuja john 2023 年 5 月 26 日
Thanks

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

その他の回答 (1 件)

Thomas Merlo
Thomas Merlo 2018 年 5 月 2 日
put each point in an [x y] vector: p1 = [1 2], p2 = [3 4]. Then plot plot([ p1(1) p2(1)], [p1(2) p2(2)]);

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by