Scaling Y-Axis by natural log scale.

23 views (last 30 days)
Quentin 'Quinn'
Quentin 'Quinn' on 27 Sep 2023
Edited: Voss on 27 Sep 2023
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 ...)

Accepted Answer

Voss
Voss on 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 Comments
Quentin 'Quinn'
Quentin 'Quinn' on 27 Sep 2023
The space in between each "equal ratio" spacing will be scaled by a factor of e ?
Voss
Voss on 27 Sep 2023
Edited: Voss on 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?

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!