필터 지우기
필터 지우기

Set Axis With Interval

조회 수: 117 (최근 30일)
Vinicius Antunes
Vinicius Antunes 2014년 7월 30일
댓글: Stelios Fanourakis 2019년 5월 13일
Hello Everybody!
I want to know how can I set the axis using interval, for example:
>> a = rand(10);
>> plot(a)
>> Min = 2;
>> Max = 4;
>> set(gca,'XLim',[Min:0.15:Max]) -> Doesn't work!!
I know that the correct syntax is "set(gca,'XLim',[Min Max])" but, I want to use interval.
Ideas?
Thank you!

채택된 답변

Ben11
Ben11 2014년 7월 30일
Maybe use XTick:
set(gca,'XLim',[2 4])
set(gca,'XTick',(2:0.15:4))
  댓글 수: 3
Image Analyst
Image Analyst 2014년 7월 30일
편집: Image Analyst 2014년 7월 30일
You can use the xlim() function instead of set:
xlim([Min,Max]);
set(gca,'XTick',[Min : 0.15 : Max]);
It's also advisable not to use Min and Max since there are built-in functions with almost the same name. If you ever forgot to capitalize, you may get unexpected results. I never use built in function names for my variables even if I do use a different case. You can thank people by "Accepting" their answer and voting for the answer also.
Stelios Fanourakis
Stelios Fanourakis 2019년 5월 13일
Hi. How can someone estimate the average of y values for every interval of the x axis as you state it?

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

추가 답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2014년 7월 30일
set(gca,'xtick', your_interval)
  댓글 수: 2
Vinicius Antunes
Vinicius Antunes 2014년 7월 30일
Hi Azzi Abdelmalek!
Work with "set(gca,'XTick',(INTERVAL))!
Thank you!
Stelios Fanourakis
Stelios Fanourakis 2019년 5월 13일
Hi. How can someone estimate the average of y values for every interval of the x axis as you state it?

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

카테고리

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

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by