How to plot a horizontal line?

17 次查看(过去 30 天)
My function is just y=2050 and I need to plot it w/o using "yline", because it's not a graph, actually. I just type this:
x=[0:0.1:110];
y=[0:10:2060];
g=2050;
plot(x,g)
And I don't get anything. Like, completely anything:
And also after that I need to mark a point (100,2050) and be able to make it bigger than my graph.
How do I solve these problems?

采纳的回答

Mikhail Konovalov
Mikhail Konovalov 2020-5-13
编辑:Mikhail Konovalov 2020-5-13
Great thanks to drummer and darova! I finally have the graph I wanted. Final code:
x=[0:0.1:110];
y=[0:10:2060];
g=2050;
p1=plot(x,g+x*0,"g");
p1.LineWidth=2;
hold on
p2=plot(100,2050,"r*");
p2.LineWidth=15;
xlim([1 110])
Result:

更多回答(2 个)

darova
darova 2020-5-12
Try this
  5 个评论
darova
darova 2020-5-13
Can you make a simple sketch of the result you expect?
Mikhail Konovalov
Mikhail Konovalov 2020-5-13
I've already got the result I wanted. Thank you!

请先登录,再进行评论。


drummer
drummer 2020-5-12
编辑:drummer 2020-5-12
y = 0:0.1:110;
x = 2050.* ones(length(y));
plot(y,x)
xlim([1 110])

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by