【问题标题】:Axis Appearance, matlab轴外观,matlab
【发布时间】:2014-11-13 21:07:47
【问题描述】:

我正在尝试在图表中绘制 cos(x) 和 sin(x)。 这是我的代码:

 t = -pi:0.01:(pi);
 x = cos(t);
 y = sin(t);
plot(t,x,'b'); hold on;
plot(t,y,'r'); 

 axis([-pi pi -1 1])


 legend('cos(t)','sin(t)','Location','NorthWest')
 title('Plot of cos(x) and sin(x) between -2\pi and 2\pi')

我想改变 y 轴上的数字,这样我就只有 -pi, -pi/2, 0 ,pi pi 有什么帮助吗?

【问题讨论】:

    标签: matlab plot


    【解决方案1】:

    你可能想要:

    set(gca,'XTick',-pi:pi/2:pi)
    set(gca,'XTickLabels',{'-\pi','-\pi/2','0','\pi/2','\pi'})
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-10-21
      • 2016-03-31
      • 1970-01-01
      • 1970-01-01
      • 2016-05-25
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多