Scaling Y-Axis by natural log scale.
23 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
I need to scale my Y-Axis by a natural log scale to apply the hvorslev method to calculate hydraulic conductivity of my sampled sites. Is there anyway to go about doing that in MATLAB ? I have dug up several documentation for doing log plots in MATLAB but none of them seem to allow for a natural log scaling. (Semilog is in log10, changing the axis in the plot function only allow for log10 ...)
0 commentaires
Réponse acceptée
Voss
le 27 Sep 2023
log10 scale is the same as natural log scale is the same as log2 scale is the same as log-any-base scale.
Logarithmic scale means that two numbers whose ratio is a given value are the same distance apart (as opposed to linear scale which means that two numbers whose difference is a given value are the same distance apart). For instance, 20 is 2 times 10, and 10 is 2 times 5, so the distance from 5 to 10 and the distance from 10 to 20 will be the same on logarithmic scale.
semilogy(1:100)
yline([5 10 20],'r') % 10-line is halfway between 5-line and 20-line
semilogy(1:100)
yline([1.25 2.5 5 10 20 40 80],'r') % all equally spaced because the ratio is two from one to the next
Those lines are at a ratio of two between them. Does the factor of 2 have something to do with log10 scale? No, it's not special. Let's pick a ratio of 3 instead.
semilogy(1:100)
yline([1 3 9 27 81],'r') % all equally spaced because the ratio is three from one to the next
semilogy(1:100)
yline([1.4 4.2 12.6 37.8],'r') % all equally spaced because the ratio is three from one to the next
How do you think the plot should look different if it were "natural log" scale?
2 commentaires
Voss
le 27 Sep 2023
Modifié(e) : Voss
le 27 Sep 2023
You can draw lines at powers of e, but the y-axis scale is still the same as before
semilogy(1:100)
yline(exp(1:4),'r')
You can put the tick marks at powers of e:
semilogy(1:100)
yticks(exp(1:4))
set(gca(),'YMinorTick','off')
And adjust their labels:
semilogy(1:100)
yticks(exp(1:4))
yticklabels("exp("+(1:4)+")")
set(gca(),'YMinorTick','off')
Is something like that what you have in mind?
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Log Plots 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!






