1
$\begingroup$

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}$$

$\endgroup$
  • $\begingroup$ I'll only have time to convert the equations to LaTeX sometimes later, sorry. $\endgroup$ – Csaba Toth May 8 '16 at 21:49
  • $\begingroup$ Thanks @John Wayland Bales for the improvement! $\endgroup$ – Csaba Toth May 9 '16 at 2:03
1
$\begingroup$

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.

$\endgroup$
  • 1
    $\begingroup$ Here's a Mathjax tutorial :) $\endgroup$ – Dando18 Jun 14 '17 at 20:37
  • $\begingroup$ I need to give that a try $\endgroup$ – Csaba Toth Nov 4 '17 at 18:30
  • $\begingroup$ Hmmm, my brain struggles a little, as the wiki says that the line equation is log10(F(x))=m*log10(x) + b. Then I understand how we get the slope m, but then how the F(x) does not depend on the b at all? The lines on the log-log graphs definitely have a b constant component otherwise everything would go through the origo (0,0). But I'll tackle this now. $\endgroup$ – Csaba Toth Dec 2 '17 at 20:54
  • $\begingroup$ You pointed to the right direction, I add the $x_3$ equation to my question $\endgroup$ – Csaba Toth Dec 3 '17 at 6:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.