add line to line plot

9 ビュー (過去 30 日間)
Jason Chan
Jason Chan 2017 年 5 月 29 日
コメント済み: Jan 2017 年 5 月 29 日
Hello, I have a basic plotting question, I have two Y-variables, one uses all X-axis values while the other Y-variable uses every other X-value; but I still want it to draw a line. How can I do that?
SOA = -230;-190;-150;-110;-70;NaN;70;110;150;190;230
Long_Y = 2.89;2.40;2.61;2.30;0.16;NaN;0.4000;1.45;2.75;3.18;3.41
Short_Y = 1.61;NaN;1.54;NaN;-0.030;NaN;0.10;NaN;1.75;NaN;1.85
thanks,
  1 件のコメント
Jan
Jan 2017 年 5 月 29 日
Let me gess: SOA is the "X-value"? "Every other" is 1:2:end? What have you tried so far? Did a problem occur?

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

採用された回答

Star Strider
Star Strider 2017 年 5 月 29 日
Try this:
figure(1)
plot(SOA, Long_Y, '-pb')
hold on
plot(SOA(1:2:end), Short_Y(1:2:end), '-pr')
hold off
grid

その他の回答 (0 件)

カテゴリ

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

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by