Plotting a line in matlab

조회 수: 1 (최근 30일)
Aftab Ahmed Khan
Aftab Ahmed Khan 2014년 8월 12일
댓글: Aftab Ahmed Khan 2014년 8월 12일
Hi everyone, I am trying to draw a stright line beneath this graph for comparison evaluation but this code doesn't work for me. Any help guys.
xline = linspace(1,14,14);
xline = 1e6*xline;
yline = xline;
plot(xline,yline,'-r*','LineWidth',4);
  댓글 수: 1
Ben11
Ben11 2014년 8월 12일
It does work for me; it looks like multiplying xline by 1e6 makes the line disappear out of your figure because your units are in Mbps. What if you don't multiply xline by 1e6?

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

채택된 답변

Joseph Cheng
Joseph Cheng 2014년 8월 12일
I do not think you need to do the 1e6*xline as the current plot you have looks to be already scaled to Mbps. Also since you're plotting a lines in two different commands you'll need to use the command 'hold on'.
such as:
figure,plot([1:10],[1:10].^2);
hold on
plot([1:10],[1:10]);
  댓글 수: 1
Aftab Ahmed Khan
Aftab Ahmed Khan 2014년 8월 12일
Just needed to remove the 1e6, its working now. Here it is, Thanks

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

추가 답변 (0개)

카테고리

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