Adding vertical line to graph

조회 수: 2 (최근 30일)
ferdaous abderrazak
ferdaous abderrazak 2019년 1월 3일
댓글: ferdaous abderrazak 2019년 1월 3일
Hello,
I'm trying to present a vertical line to my graph as you can see below but I don't get the curve of the vetical line

채택된 답변

Cris LaPierre
Cris LaPierre 2019년 1월 3일
편집: Cris LaPierre 2019년 1월 3일
If you are on the latest version of MATLAB (18b), try using the new xline function.
xline(x1)
Otherwise, what happens if you use the plot function instead of line?
plot([x1 x1],[y0 y1])
  댓글 수: 2
Cris LaPierre
Cris LaPierre 2019년 1월 3일
편집: Cris LaPierre 2019년 1월 3일
Never mind. I see what you are doing.
You plot your line using frequency(k) for x, but everything else is plotted using frequency(k)/1e9 for x. Your line is being plotted waaaayyyy off to the right.
You also set the limits of your X axis using the axis function to frequency/1e9.
Your lines are there, but you've clipped them off. Try
x1 = x1/1e9;
line([x1 x1],[y0 y1])
or comment out the line of code containing the axis command. This will make it more obvious what is happening.
ferdaous abderrazak
ferdaous abderrazak 2019년 1월 3일
thank you

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

추가 답변 (1개)

madhan ravi
madhan ravi 2019년 1월 3일
편집: madhan ravi 2019년 1월 3일
Save the variable in each iteration and plot it outside the loop , you seem to be overwriting them so finally you try to plot a point . Upload your code if you are not able to figure it out.

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by