Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

axis X special type

Asked by Matus

Matus (view profile)

on 23 Apr 2013

Hello,

I would like to construct a graph which has the axis x with values arranged 3, 2, 1, 0, 1, 2, 3, ... (normally, it would be -3 -2 -1 0 1 2 3 .. but I need it as mentioned above). Can anyone help me?

Thank you.

0 Comments

Matus

Matus (view profile)

Tags

Products

No products are associated with this question.

1 Answer

Answer by the cyclist

the cyclist (view profile)

on 23 Apr 2013
Edited by the cyclist

the cyclist (view profile)

on 23 Apr 2013
Accepted answer

Here's one way.

figure
plot(-3:3,1:7,'.-')
set(gca,'XTickLabel',[3 2 1 0 1 2 3])

Note that I have only changed the label of the axis, but not the values of the plotted points themselves, which still have x values running from -3 to 3.

1 Comment

Matus

Matus (view profile)

on 23 Apr 2013

ok, thank you, it's useful for me.

the cyclist

the cyclist (view profile)

Contact us