Tuesday 22 October 2013

How to give names to each indices of an axis in Matlab?

Taken from Matlab help:

x = -pi:.1:pi;
y = sin(x);
p = plot(x,y)

set(gca,'XTick',-pi:pi/2:pi)

set(gca,'XTickLabel',{'-pi','-pi/2','0','pi/2','pi'})

xlabel('-\pi \leq \Theta \leq \pi')

ylabel('sin(\Theta)')

title('Plot of sin(\Theta)')

No comments:

Post a Comment