如何在MATLAB中标记x轴上的特定点?

时间:2016-03-17 14:47:36

标签: matlab plot

enter image description here

如何在绘制阴影时让x轴仅显示这两个值?

1 个答案:

答案 0 :(得分:0)

使用XTickXTickLabel的组合,例如:

x = -pi:pi/360:pi;
y = sin(x)
plot(x,y)
doc xtick
set(gca,'XTick',[-pi/2 pi/2],'XTickLabel',{'-\pi/2','\pi/2'})

这样的东西:

enter image description here

有关详细信息,请参阅文档中的Change Axis Tick Values and Labels