当前位置:文档之家› matlab坐标轴操作大全

matlab坐标轴操作大全



坐标轴标注:

1. 控制坐标轴尺度长度:set(gca,'XLim',[-pi/2 pi])

2. 定制自己想标注的刻度:

set(gca,'XTick',[-pi/2:pi/4:pi]) %坐标轴最小值,步长,最大值(设置坐标轴的刻度)

set(gca,'XTickLabel',{'-pi/2' '-pi/4' '0' 'pi/4' 'pi/2' 'pi*3/4' 'pi'})%设置想要的刻度

例题:
x=[1 2 4 8]
y=2*sin(x);
plot(x,y);
set(gca, 'XTick', [1 2 4 8], 'XTickLabel', {'0','1','2','8'})





x=[0.01 0.19 1.5 30 60 130 300 800];
y=[0.0024 0.001 0.00046 0.00023 0.0001 0.00017 0.00009 0.00045];
set(gca,'XLim',[0.01 1000]);
set(gca,'XMinorTick','on');
set(gca,'XTick',[0.01 0.1 1 10 100 1000]);
set(gca,'XGrid','on');
set(gca,'YLim',[0.0000001 0.01]);
set(gca,'YGrid','off');
set(gca,'YMinorGrid','off');
set(gca,'XMinorGrid','off');
set(gca,'YLim',[0.0000001 0.01]);
set(gca,'YMinorTick','on');
set(gca,'YTick',[0.0000001 0.000001 0.00001 0.0001 0.001 0.01]);
set(gca,'YGrid','off');
set(gca,'YMinorGrid','off');

相关主题
文本预览
相关文档 最新文档