Horizontal line in plot up to a graph

2 Ansichten (letzte 30 Tage)
Mepe
Mepe am 26 Feb. 2021
Kommentiert: Mepe am 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.

Antworten (1)

KSSV
KSSV am 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 Kommentare
Mepe
Mepe am 26 Feb. 2021
I don't understand the code. How would you elegantly solve this with the line command? In such a way that it only runs to the graph?
Thanks!
Mepe
Mepe am 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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Discrete Data Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by