Fixing the interval

조회 수: 1 (최근 30일)
Kavish Chaurasia
Kavish Chaurasia 2011년 7월 6일
I have a curve plotted against time from 0s to 10s, but I want that my curve should start at 2 and end at 10,how can I achieve that?

채택된 답변

Gerd
Gerd 2011년 7월 6일
Hi Kavish,
% set xLim to start at 2
set(gca,'XLim',[2 10]);
Gerd
  댓글 수: 2
Kavish Chaurasia
Kavish Chaurasia 2011년 7월 6일
thanks a lot. Could you also tell me if i want to see the values between 0 and 2 as nothing then what should i do? I mean i want to see the whole x-axis from 0 to 10 but i want my values to start from x=2,
Jan
Jan 2011년 7월 6일
@Kavish: All you need can be found in this thread already: plot(rand(1, 11), linspace(2, 10, 11));, set(gca, 'XLim', [0, 10]);

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

추가 답변 (1개)

Jan
Jan 2011년 7월 6일
Set the Y-values for the plot accordingly:
figure;
plot(rand(1, 11), linspace(2, 10, 11));
Or do you want to crop the first seconds?
figure;
AxesH = axes;
plot(rand(1, 11), 0:10);
pause(1);
set(AxesH, 'XLim', [2,10]);
  댓글 수: 2
Kavish Chaurasia
Kavish Chaurasia 2011년 7월 6일
what should i do if am using simulink? i knew that in MATLAB.
Jan
Jan 2011년 7월 6일
@Kavish: Please mention in the question, if the problem concerns Simulink. Then I can save my time for answering, because I have not worked with Simulink ever.
And if you know this in Matlab, I do not understand, why you accept an answer, which does not solve your problem. This reduces the chance, that an experienced Simulink will look in this thread later on.

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

카테고리

Help CenterFile Exchange에서 Graphics Objects에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by