Converting Y-axis values to the base of 10

23 vues (au cours des 30 derniers jours)
Parisa Afkari
Parisa Afkari le 26 Nov 2022
Hi,
I have a below code which gave me a plot like what I attached:
%importing data
data_fluide = load('data_fluid_AC220.txt');
t_fluide= data_fluide_ac220(:,1);
dilution=data_fluide_ac220(:,13);
data_fluide_ac225 = load('data_fluid_AC225.txt');
t_fluide_ac225 = data_fluide_ac225(:,1);
dilution_ac225=data_fluide_ac225(:,13);
t1=t_fluide;
y1= log(dilution);
t2= t_fluide_ac225;
y2= log(dilution_ac225);
figure(1)
fitobject1 = fit(t1,y1,'poly3');
fitobject2=fit(t2,y2,'poly3');
plot (fitobject1)
hold on
plot (fitobject2)
hold off
But now I want to convert the value of Y-axis to go to the basis of 10 and my Y-axis be like 10^-6, 10^-5,....,10^0,10^1.
I tried many things but could not find a good solution. I appreciate if anyone have aan experience with this.
Thank you
Parisa

Réponses (1)

Star Strider
Star Strider le 26 Nov 2022
This can be done easily using ytickformat (introduced in R2016b) —
x = linspace(0, 2.5);
y = 6*exp(-1.5*x) - 6;
figure
plot(x, y)
ytickformat('10^{%2d}') % Set Format
.

Catégories

En savoir plus sur Visual Exploration dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by