Message Boards Message Boards

0
|
2350 Views
|
4 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Help fitting a dataset?

Posted 1 year ago
data1 = {0,2244}, {3.5, 2134}, {7, 2250}, {10.5, 2435}, {14, 
       17.2}, {17.5, 16.8}}
    data2= {0,0}, {3.5, 2.6}, {7, 5.5}, {10.5, 6.2}, {14, 
       6.6}, {17.5, 7.8}}

I have these two data sets in one graph, the same x but two y axis. Now I want to fit my data. I can do polynomial fit for data2, but what function can I use for data1? Any help would be appreciated!

POSTED BY: Zoeyy Dong
4 Replies

Hello Zoeyy,

you don't say anything about the background (physics) of your data, so I have no idea of a reasonable fit. What do you think of this?

fff = FindFit[data1, a (1 - b Erf[x - c]), {{a, 2200}, {b, 3}, {c, 12}}, x]
h = a (1 - b Erf[x - c]) /. fff
Plot[h, {x, 0, 18}, PlotRange -> {0, 2500},  Epilog -> {Red, PointSize[.02], Point /@ data1}]
POSTED BY: Hans Dolhaine
Posted 1 year ago

That is exactly what I need. Thank you very much!!!

POSTED BY: Zoeyy Dong

Hi Zoeyy,

A polynomial would be a very bad fit to the values in data1

ListPlot[{data1, data2},
 Joined -> True,
 Mesh -> All,
 MultiaxisArrangement -> All]

enter image description here

Are you sure the values are correct?

POSTED BY: Rohit Namjoshi
Posted 1 year ago

Hi Rohit, thanks for the help. Yeah I will need another function for data 1, but I don't know what might be a good function equation.

POSTED BY: Zoeyy Dong
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract