How matlab converts data from linear scale to log scale?
Show older comments
Hi.
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:
may=xlsread('may.xlsx','msd','A1:F1000');
t=may(:,2);
y=may(:,6);
figure(1)
plot(t,y,'r');
ax1 = gca; % current axes
ax1.XColor = 'r';
ax1.YColor = 'r';
ax1_pos = ax1.Position; % position of first axes
ax2 = axes('Position',ax1_pos,...
'XAxisLocation','top',...
'YAxisLocation','right',...
'Color','none');
%xlim([100 10000])
t1=may(:,2);
y1=may(:,6);
hold on
plot(t1,y1,'Parent',ax2,'Color','k')
ha=gca;
set(ha,'yscale','log');
set(ha,'xscale','log');

Thanks
1 Comment
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.
Accepted Answer
More Answers (0)
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!