How to get the ticks for each value of the logarithmic scale?

조회 수: 73 (최근 30일)
Tahariet Sharon
Tahariet Sharon 2018년 2월 26일
댓글: Star Strider 2018년 2월 26일
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.
  댓글 수: 1
Jan
Jan 2018년 2월 26일
Can you post an example of what you mean? A screen shot or picture?

댓글을 달려면 로그인하십시오.

채택된 답변

Star Strider
Star Strider 2018년 2월 26일
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:
  댓글 수: 4
Tahariet Sharon
Tahariet Sharon 2018년 2월 26일
Thanks. I still don't understand why there is a bigger gap from 10Hz to 20 Hz than from 70Hz to 80Hz.
Star Strider
Star Strider 2018년 2월 26일
My pleasure.
The decreasing gaps are due to plotting logarithmic values on a linear scale (which is what the semilog axis does).
Consider:
Xtix = log10(10:10:100)
DiffXTix = diff([0 Xtix])
Xtix = 1.0000 1.3010 1.4771 1.6021 1.6990 1.7782 1.8451 1.9031 1.9542 2.0000
DiffXTix = 1.0000 0.3010 0.1761 0.1249 0.0969 0.0792 0.0669 0.0580 0.0512 0.0458
You can see that the differences between the logarithm values decrease as the values themselves increase. That is the nature of logarithms, and what the plot illustrates.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Log Plots에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by