I need to plot an Interpolation function of one independent variable (only a 3kB file) on LogPlot
and show the slope of its linear part together on the LogPlot
, as manually drawn with a dashed red line in the following figure. But when I Show
the LogPlot
and a line with the slope of the linear part (see step 3), it turned out to be inconsistent.
import data and plot:
data = <<"...\\data.m"; logPlot = LogPlot[data[t], {t, 0, 2}, PlotRange -> {{0, 2}, {0.01, 30000}}, Frame -> True]
Observe the range of linear part and find a linear fit:
lineardata = Table[Log[data[t]], {t, 1, 1.2, 0.02}]; linearpart = Fit[lineardata, {1, t}, t]; (*0.923913 + 0.689265 t*)
Show together with the
linearpart
, it was found that thelinearpart
does not parallel to the linear part of the data onLogPlot
.Show[logPlot, LogPlot[Exp[linearpart], {t, 1, 1.2}, PlotStyle -> {Red, Dashed}]]
What's wrong with this? Please help. I have updated the code according to the comments. Thanks for @Roman's suggestion.
LogPlot
forlinearpart
too? $\endgroup$LogPlot[Exp[linearpart], ...]
$\endgroup$data
(the interpolating function and the list of values). $\endgroup$