MATLAB: How to get the ticks for each value of the logarithmic scale

codelogarithmic graph scale

Hi,
I'm learning to read logarithmic graphs and haven't found anywhere what the ticks between 10^0 and 10^1 for instance are (they are not 10^.1, 10^.2, etc because the gap becomes smaller, and not larger…) and how to plot them in Matlab. Any help appreciated.

Best Answer

The ticks between 10^0 (or 1) and 10^1 (or 10) are the integers between 1 and 10. They are scaled logarithmically, so the apparent distance between them appears to decrease.
This example code:
x = linspace(0.1, 1.0, 10);
y = x;
figure(1)
semilogx(x, y)
ax = gca;
ax.XMinorTick = 'on';
ax.XAxis.TickValues = x;
ax.XAxis.Exponent = 1;
xlabel('Logarithmic X-Axis')
ylabel('Linear Y-Axis')
title('Illustrating Logarithmic Scaling')
produces this plot: