# Interpolate on log scale

I have data in Mathematica that comes from y-log scale

Data = {{5.0, 23.87548081003781},
{6.94392523364486, 0.511639358262082},
{8.925233644859812, 0.23397526329810545},
{10.962616822429906, 0.16190746961888203},
{12.906542056074766, 0.17751810380557045},
{14.925233644859812, 0.25653445869951874}};


These points should be connected by straight line on log scale like this

ListLogPlot[Data, Joined -> True]


I want to find interpolated function with straight lines on log plot(just like above code), however naive result gives me:

LogPlot[Interpolation[Data, InterpolationOrder -> 1][x], {x, 5, 14}]


which does not have straight lines on logPlot, it has straight lines on Plot.

How can I interpolate data on log plot?

• what if you use InterpolationOrder with ListLogPlot like ListLogPlot[Data, Joined -> True, InterpolationOrder -> 3] – Sumit Jul 9 '17 at 9:11
• Dear Sumit, thank you for the reply, this gives me a smoother plot, but I want an interpolated function which would look like ListLogPlot[Data, Joined -> True] – Wint Jul 9 '17 at 9:28
• It'll be due to the difference between interpolating in log space or linear space. This'll get you what you want: if = Exp@*Interpolation[{#1, Log[#2]} & @@@ Data, InterpolationOrder -> 1] then LogPlot[if[x], {x, 5, 14}] – Quantum_Oli Jul 9 '17 at 9:47
• Quantum_Oli thank you very much!! Please post as an answer and I mark it as solved. :) – Wint Jul 9 '17 at 10:02

[Just noticed this was @Quantum_Oil's idea in a comment above. Probably why I didn't answer before.]

Often one interpolates to avoid transcendental functions, but the OP's objective cannot be achieved with polynomial interpolation. So I assume something like the following, which reproduces ListLogPlot[Data, Joined -> True], is desired:

ClearAll[logIF];
logIF[x_] =
Exp[Interpolation[MapAt[Log, Data, {All, 2}], InterpolationOrder -> 1][x]];
LogPlot[logIF[x], {x, 5, 14}]


The first point of your Data is an extreme outlier which we eliminate with

data = Rest @ Data;


We also need

xmax = Max @ data[[All, 1]]


14.9252

Show[
ListLogPlot[data],
LogPlot[Evaluate @ NonlinearModelFit[data, Exp[a + b x], {a, b}, x][x], {x, 0, xmax}]]


• Technically a fit is not an interpolation. An interpolation reproduces every data point. – Markus Roellig Jul 10 '17 at 10:30
• OP wants a "straight line on log scale" which, you're right, is a fit :) – eldo Jul 10 '17 at 10:40