How matlab converts data from linear scale to log scale?

92 views (last 30 days)
I plot the figure from column 2 (as x) and column 6 (as y) in excel file in linear and log scale. Why 1500 in linear scale is100 in logarithmic scale? How matlab changes data (t1 and y1) into logarithmic form and how plot that?
The code:
ax1 = gca; % current axes
ax1.XColor = 'r';
ax1.YColor = 'r';
ax1_pos = ax1.Position; % position of first axes
ax2 = axes('Position',ax1_pos,...
%xlim([100 10000])
hold on
  1 Comment
David Hill
David Hill on 3 Sep 2020
You can see the end points are the same. The black has the black axes and the red has the red axes, but the axes do not correlate to each other.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 3 Sep 2020
>> ax1.XLim
ans =
0 3000
>> ax2.XLim
ans =
1 10000
You did not linkaxes(), so the XLim are set independently of each other. The automatic scale setting prioritizes "nice" numbers. 10^ceil(log10(3000)) --> 10000
Walter Roberson
Walter Roberson on 4 Sep 2020
In the forward direction,
fp = polyfit(log10(t), log10(y), 4);
gives a quite good fit for the data that exists. And you can also reasonably use degree 4 on t vs y like I did above. But the interpolation for that at log10(y) = 100 gives a t way out of range.
In order to interpolate out anywhere close to as far as you want to (to the point where y has reached 10^100) then you need a really good model of what your data is.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by