Horizontal line in plot up to a graph

조회 수: 2 (최근 30일)
Mepe
Mepe 2021년 2월 26일
댓글: Mepe 2021년 2월 26일
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.

답변 (1개)

KSSV
KSSV 2021년 2월 26일
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
Mepe
Mepe 2021년 2월 26일
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 2021년 2월 26일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Discrete Data Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by