How to adjust the axis scale in MATLAB?
In Matlab, you can use the functions xticks and yticks to set the scale of the axes.
Here is an example:
x = 0:0.1:2*pi;
y = sin(x);
plot(x, y)
xticks(0:pi/2:2*pi) % 设置x轴刻度
yticks(-1:0.5:1) % 设置y轴刻度
In the example above, the x-axis ticks are set from 0 to 2*pi with intervals of pi/2 using the xticks function; the y-axis ticks are set from -1 to 1 with intervals of 0.5 using the yticks function.
You can also pass a vector to customize the tick positions in the xticks and yticks functions.