Hi,
I'm trying to put the x axis with a step of 50 nm, but the output is 0 to 350 nm instead of 0 to 3600 nm.
subplot(2,1,2);
plot(lambda./1e-9, t/1e-9);
grid on;
axis tight;
set(gca,'XTickLabel', 0:50:3600);
xlabel('Comprimento de Onda [nm]');
ylabel('Espessura mínima [nm]');
What I'm doing wrong?
Thanks!

 채택된 답변

VBBV
VBBV 2020년 11월 26일
편집: VBBV 2020년 11월 26일

0 개 추천

%if true
set(gca,'XTicks', 0:50:3600);
xlabel('Comprimento de Onda [nm]');
ylabel('Espessura mínima [nm]');
Use XTicks

댓글 수: 8

I already try that, but it seems my MatLab version does't support it. I get the error
Error using matlab.graphics.axis.Axes/set
There is no XTicks property on the Axes class.
VBBV
VBBV 2020년 11월 26일
What is the maximum value of lambda vector ? If it's 350nm then x-axis will display up to 350nm
Oliver Lestrange
Oliver Lestrange 2020년 11월 26일
3600 nm
VBBV
VBBV 2020년 11월 26일
편집: VBBV 2020년 11월 26일
%if true
ax = gca
set(ax,'xticks', (0:50:3600).*1e-09);
xlabel('Comprimento de Onda [nm]');
ylabel('Espessura mínima [nm]');
Try using handle
VBBV
VBBV 2020년 11월 26일
There is no 'XtickLabel' or XTick but use all in small case as xtick or xticklabel.
VBBV
VBBV 2020년 11월 26일
편집: VBBV 2020년 11월 26일
%if true
xlim([0 3600*1e-09])
Use xlim after the plot
VBBV
VBBV 2020년 11월 27일
I think you are dividing lambda with 1e-9 which gives you a large number. You have ylabel and xlabel in nm. So you should multiply with 1e-9 in plot.
%if true
subplot(212)
plot(lambda.*1e-9,t*1e-9)
Oliver Lestrange
Oliver Lestrange 2020년 11월 27일
I solved it with xtick instead of XTickLabel.
Thanks a lot VBBV!

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Axis Labels에 대해 자세히 알아보기

질문:

2020년 11월 26일

댓글:

2020년 11월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by