Example:
n = [-100:100];
x = cos(0.1*pi*n);
Hx = stem(n,x,'r--','filled');
set(Hx,'markersize',2);
axis([-110, 110,-2,2]);
xtick = [-100:18:100];
ytick = [-2:0.5:2];
set(gca,'XTickMode','manual','XTick',xtick);
set(gca,'YTickMode','manual','YTick',ytick);
xlabel('n','FontSize',10);
ylabel('x(n)','FontSize',10);
其中水平座標刻度設定
xtick = [刻度由此開始:刻度間隔:刻度結束]
垂直座標刻度設定亦同
ytick = [刻度由此開始:刻度間隔:刻度結束]