[Math] Interpolation / point fitting onto a logarithmic line segment

interpolationlogarithms

I have figure which is logarithmic scale on both axis. There's a line on that figure, I know two points on that line and want to interpolate a third point on that line based on the two known points.

enter image description here

(What you see basically is a curve which is constituted of linear segments. I'll only do interpolation within such a linear segment, knowing the two boundary points of the segment. The input value (flow) is on the $y$ axis, and I'm looking for the $x$ value related to that.

enter image description here

There's a linear interpolation (by computing fractions), but my recent try on logarithmic interpolation sometimes produces worse results than the linear one. Disappointing.

First I tried to follow http://mathforum.org/library/drmath/view/69930.html which was a disaster.

https://docs.google.com/drawings/d/1mTRtk-qx90a8LW8viq16CWSg4UXgwLwpXIuht55pCbA/edit?usp=sharing

Then I tried to think (My Take: on the Google Drawing).
What am I missing? The outcome is close to the curve, but I want an interpolation which fits a point spot on to the line segment. Mathematically that should be possible.

I feel like I'm missing an logarithmic/exponential part somewhere, but I don't know where.

My Take if the two end point of the line segment is $(x_1, y_1)$ and $(x_2, y_2)$, the measurement $y_3$, and I want to know $x_3$ (see Google Drawing):
\begin{align}
y_1 &= 10^{ax_1 + b}\\
y_2 &= 10^{ax_2 + b}\\
\log(y_1) &= ax_1 + b \\
\to b &= \log(y_1) – ax_1\\
\log(y_2) &= ax_2 + b \\
\to a &= \frac{\log(y_2) – b}{x_2}\\
&= \frac{\log(y_2) – (\log(y_1) – ax_1)}{x_2}\\
a &= \frac{\log(y_2) – \log(y_1) + ax_1}{x_2}\\
ax_2 – ax_1 &= \log(y_2) – \log(y_1)\\
a &= \frac{\log(y_2) – \log(y_1)}{x_2 – x_1}\\
y_3 &= 10^{ax_3 + b}\\
x_3 &= \frac{\log(y_3) – b}{a}
\end{align}


@John pointed to the right direction and the Wiki article helped.
The difference is that I'm looking for $x_3$. So the

$$y_3 = y_1 * \left(\frac{x_3 }{ x_1}\right) ^ m$$

equation transforms to:

$$x_3 = x_1 * \left(\frac{y_3 }{ y_1}\right) ^ {1/m}$$

Best Answer

I think you're using the wrong form of the base equation.

From https://en.wikipedia.org/wiki/Log%E2%80%93log_plot

the relationship should be of the form $y = a * x ^ k$. Working through the "Finding the Function from the Log-Log Plot" section of the wiki page, I found that calculating

$$ k = \frac{\log_{10}(y_2 / y_1) }{ \log_{10}(x_2 / x_1)} $$

Allowed me to return

$$y_3 = y_1 * \left(\frac{x_3 }{ x_1}\right) ^ m$$

which looks correct on my graphs. Sorry for the formatting. Hope that helps. The math on the wiki is much more insightful than this answer.

Related Question