0

I am very much new to Mathematica, and facing several difficulties. I used the following code

Fit[{2, 4, 6, 8}, {1, x}, x]

The output is 8.88178*10^-16 + 2. x.

Now I have the following data set.

{0.1,2},{0.12,3},{0.15,4.2},{0.17,5}

How can I fit this data set?

dr.blochwave
  • 8,768
  • 3
  • 42
  • 76
  • 2
    Also take a look at question 80998 for some discussion of the different fitting functions in Mathematica. – MarcoB May 01 '15 at 08:03
  • 2
    Really, the very first example on the Fit doc page shows this use case. Although we love to help people out here, we also appreciate it if we see some minimal effort. I don't want to be too harsh on you, but it seems that this minimal effort is lacking here. – Sjoerd C. de Vries May 01 '15 at 11:11

1 Answers1

1

Like this?

data = {{0.1, 2}, {0.12, 3}, {0.15, 4.2}, {0.17, 5}};
line = Fit[data, {1, x}, x];
Show[Plot[line, {x, 0, 0.2}], ListPlot[data]]

enter image description here

Julian
  • 492
  • 4
  • 9
  • It works fine... – kallol mondal May 01 '15 at 10:15
  • 3
    I would strongly advise you to get used to going through the docs. If you are new to Mathematica, the documentation is likely to be immensily helpful, as it has been for me. This answer came straight out of an example in the docs. – Julian May 01 '15 at 10:32