TransWikia.com

how can I make a trend line fit close to (0,0) but not include (0,0) in my data?

Mathematica Asked on August 29, 2021

I have five data sets, {4.88281 10^(-5), 0.0788}, {9.76563 10^(-5), 0.1014}, {0.000195313, 0.12455}, {0.000390625, 0.15594}, {0.0015625, 0.18587}. I was using EXCEL to add the trendline, but the x intercept is a negative value. I wanted to fit the trendline close to zero but don’t include (0,0) in my plot, can I get this done with Mathematica?

Thanks!

One Answer

data = {{4.88281 10^(-5), 0.0788}, {9.76563 10^(-5), 0.1014}, {0.000195313, 0.12455},
  {0.000390625, 0.15594}, {0.0015625, 0.18587}};

lm = LinearModelFit[data, Log[x], x]
Show[ListLogLinearPlot[data], 
 LogLinearPlot[lm[x], {x, Min[data[[All, 1]]], Max[data[[All, 1]]]}]]

Data and fit with x on log scale

Show[ListPlot[data], 
 Plot[lm[x], {x, 0, Max[data[[All, 1]]]}, PlotRange -> All]]

Data and fit

Answered by JimB on August 29, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP