Horizontal line in plot up to a graph

8 views (last 30 days)
Mepe
Mepe on 26 Feb 2021
Commented: Mepe on 26 Feb 2021
How can I generate a horizontal line starting at x = 0 up to a graph (see figure, red line)? The x, y coordinates are of course available for the graph.

Answers (1)

KSSV
KSSV on 26 Feb 2021
If you have the xlimits (x0,x1) and the y-value..the required equations is y = k.
x = 1:10 ;
k = 3 ;
y = k*ones(*Size(x)) ;
plot(x,y)
Also have a look on line.
  2 Comments
Mepe
Mepe on 26 Feb 2021
The value x1 should be freely chosen. From the point of intersection with the function (x, y) the line should run horizontally to x = 0.

Sign in to comment.

Categories

Find more on Line Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!