The follow plot shows my question:
I would like to add a line between the points of 1e-1 and 1e-2. So I thought just (1e-1+1e-2)/2.
But for a log scale that is not "midway".
How can I calculate the "visual" midway value between these, or any two points in this case? Code used is
clc; clear all;
y = logspace(-3,0,100);
x = y;
semilogx(y,x);
hold on
plot([1e-1 1e-1],get(gca,'YLim'),'k--');
plot([1e-2 1e-2],get(gca,'YLim'),'k--');
midway = (1e-1+1e-2)/2;
plot([midway midway],get(gca,'YLim'),'k--');
Thanks
a=1e-2
b=1e-1
midway = exp((log(a)+log(b))/2)
Take the log to get the positions in log scale, then do the math.
You could simplify that formula and you will end up with a geometric mean:
midway=sqrt(a*b)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With