1. ## Logarithmic Interpolation

I知 trying to interpolate on a logarithmic scale for a program I知 working on and have been banging my head against the desk trying to develop a formula for this and I知 hoping maybe someone either already has one or can give me some assistance. The entire graph is situated in an arbitrary coordinate system (it痴 displayed on a screen, so the coordinate system is the x,y pixel coordinates.) So I know the screen coordinates of the two points and the real values of these points (what they user tells the program they are). Now I need to find the corresponding real value of a new point that is placed on the graph when I only know the screen coordinates.

Ex: The graph below, I would know the value of the red squares but do not know the value of the green square, but I know the "coordinates" of each. The X-axis is logarithmically scaled.

Further expanded example with numbers:
Say the left red square is at 100 pixels and represents a value of 1.
The right red square is at 500 pixels and represents 10.
The green square is at 200 pixels and I need to find it's value.

2. Originally Posted by bceros
I知 trying to interpolate on a logarithmic scale for a program I知 working on and have been banging my head against the desk trying to develop a formula for this and I知 hoping maybe someone either already has one or can give me some assistance. The entire graph is situated in an arbitrary coordinate system (it痴 displayed on a screen, so the coordinate system is the x,y pixel coordinates.) So I know the screen coordinates of the two points and the real values of these points (what they user tells the program they are). Now I need to find the corresponding real value of a new point that is placed on the graph when I only know the screen coordinates.

Ex: The graph below, I would know the value of the red squares but do not know the value of the green square, but I know the "coordinates" of each. The X-axis is logarithmically scaled.

Further expanded example with numbers:
Say the left red square is at 100 pixels and represents a value of 1.
The right red square is at 500 pixels and represents 10.
The green square is at 200 pixels and I need to find it's value.
Believe it or not but about 15 years ago I had exactly the same problem. I derived the formula after an hour of mistakes and swearing at myself, so I know how you feel. I wrote the result down in my personal formula book and here it is. Call the screen coordinates S1, S2 and S as the left red, right red and green dot's coordinates. Also call the respective values of them X1, X2 and X. The connection is now:

$\displaystyle \frac{log(X)-log(X_1)}{log(X_2)-log(X_1)}=\frac{S-S_1}{S_2-S_1}$

As you can see it is a fairly simple linear relationship between the screen coordinates and the logarithm of the values. In the example you gave the value is 1.777... if I did not make a mistake :-) Have fun with the programming.

Coomast

3. Thank you very much! That is working great!

,

,

,

,

,

,

,

,

,

,

,

,

,

,

# logarithic interpolation

Click on a term to search for related topics.