How do I make such plot using axis command?

조회 수: 1 (최근 30일)
Altin Guberi
Altin Guberi 2015년 6월 19일
댓글: Azzi Abdelmalek 2015년 6월 19일
Hello . Okay so the x values are x=0:0.5:2 , while y=10:10:30 . Now I want to know if there is any way to make a plot using axis command which shows these on x axis 0 0.5000 1.0000 1.5000 2.0000 and these on y axis 10 20 30 . Thank you and have a nice day!!

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2015년 6월 19일
편집: Azzi Abdelmalek 2015년 6월 19일
x=0:0.5:2 ,
y=10:10:30
plot(y)
h=gca
xt=get(h,'xtick')
set(h,'xtick',linspace(xt(1),xt(end),numel(x)))
set(h,'xticklabel',arrayfun(@num2str,x,'un',0))
  댓글 수: 2
Altin Guberi
Altin Guberi 2015년 6월 19일
no , I want it the y axis to appear only 10 20 30 . Can you make this?
Azzi Abdelmalek
Azzi Abdelmalek 2015년 6월 19일
Ok:
x=0:0.5:2 ,
y=10:10:30
plot(y)
h=gca
xt=get(h,'xtick')
set(h,'xtick',linspace(xt(1),xt(end),3))
x1=[10 20 30];
set(h,'xticklabel',arrayfun(@num2str,x1,'un',0))

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

카테고리

Help CenterFile Exchange에서 Computer Vision Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by