Multiple Plot lines on a single plot

6 ビュー (過去 30 日間)
Kieran Reeves
Kieran Reeves 2020 年 4 月 29 日
コメント済み: Ameer Hamza 2020 年 4 月 29 日
Hi
I would like to join x,y coordinates for 2 points together on a plot. But also plot all 361 lines.
I have all coordinates saved as 361 x 1
x coordinate left = xl
y coordinate left = yl
x coordinate right = xr
y coordinate right = yr
I can combine into 2 columns if required so which will determine a point on a plot a(1), a(2), b(1), b(2) etc to 361
a = [xl, yl]
b = [xr, yr]
But I basically need to plot a line between
a(1) and b(1)
a(2) and b(2)
and so on for 361 seperate lines on 1 plot.
Is this possible and is there a quicker way than using hold on 361 times?
Thanks for any advice
Kieran

採用された回答

Ameer Hamza
Ameer Hamza 2020 年 4 月 29 日
try this
x = [xl.'; xr.']; % xl, xr, yl and yr should be column vectors
y = [yl.'; yr.'];
plot(x, y)
  2 件のコメント
Kieran Reeves
Kieran Reeves 2020 年 4 月 29 日
Perfect Ameer, thankyou.
Ameer Hamza
Ameer Hamza 2020 年 4 月 29 日
I am glad to be of help.

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

その他の回答 (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