How to Change the Exponential Scale in axis to linear scale?
20 views (last 30 days)
I have a 3D surface which is being read from a file (one example file is attached). My X and Y axis are linear. I am converting the Y axis using a formula to Exponential type. After conversion, I want to plot the the 3D surface with the modifications. When I plot the data, the Y axis is also shown in Exponential. Now, I want to change the axis in a way to be shown as linear, without changing the Exonential data (only the view of axis). Is there any way to do that? I am using this code:
csvfiles = dir('*.csv');
for file = csvfiles'
for i=1: L
Thank You so much for your support.
dpb on 12 Aug 2022
Guessing at what you mean, precisely, try something like--
Dalton=8.227*exp(1)+6*exp(-7.9591*exp(1)*y); % use MATLAB vector syntax, no loop needed here
[du,ia]=unique(Dalton,'stable'); % the double exponential saturates very quickly
yu=y(ia); % the y values to match
ytks=yticks; % retrieve default tick values y axis
ytks=ytks(iswithin(ytks,min(du),max(du))); % save only those within range that exists
yticks(ytks) % set the new subset on plot
yticklabels(interp1(du,uy,ytks)) % label with y that produced that Dalton on tick
The double exponential saturates very quickly as can be seen
And interp1 won't work with duplicate values on the X direction for the reverse lookup; hence the unique to retrieve all values that are numerically distinguishable.
Then, to have values that will produce a result for y, must restrict the shown tick values to be within that range.
iswithin is my handy-dandy utility routine
% returns T for values within range of input
% [log] = iswithin(x,lo,hi)
% returns T for x between lo and hi values, inclusive
flg= (x>=lo) & (x<=hi);