How to produce line plot yline for matlab R2018a

15 ビュー (過去 30 日間)
Emilia
Emilia 2021 年 1 月 5 日
コメント済み: madhan ravi 2021 年 1 月 5 日
Hello,
My computer has R2018a old version software, I do not have time to download it.
I want to add in the graph a line in y=260, How to do and there is a special code for it?
Thanks for the helpers
yline(260,'--r','Ground'); %No work

採用された回答

madhan ravi
madhan ravi 2021 年 1 月 5 日
編集済み: madhan ravi 2021 年 1 月 5 日
Start = 0; % sorry I completely misinterpreted the question xD
End = 1;
Point = 260;
plot(linspace(Start, End, 1e2), repelem(Point, 1e2), '--r')
text(End - .11, Point + .07, 'Ground', 'Color', 'r')

その他の回答 (2 件)

William
William 2021 年 1 月 5 日
It's not really necessary to plot 100 points along the line. The first and last points are enough, as in:
plot([0,1],[260,260],'--r');

madhan ravi
madhan ravi 2021 年 1 月 5 日
Funny thing , i did a file exchange a while ago for passing time, not the efficient one but gets the job done ;)
  2 件のコメント
madhan ravi
madhan ravi 2021 年 1 月 5 日
編集済み: madhan ravi 2021 年 1 月 5 日
start_point = -260/2;
end_point = 260/2;
plot(260*ones(1e2, 1), linspace(start_point, end_point, 1e2), '--r')
madhan ravi
madhan ravi 2021 年 1 月 5 日
yline(260,'--r','Ground'); %No work

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

カテゴリ

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