I have some data, and I used SmoothHistogram to obtain a curve.
Now I would like to pick up several points on the curve such that I can fit this curve to a function. I get stuck with picking up points. Can anyone help me with this?
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityI have some data, and I used SmoothHistogram to obtain a curve.
Now I would like to pick up several points on the curve such that I can fit this curve to a function. I get stuck with picking up points. Can anyone help me with this?
If you just want the points, you can get them out of the Graphics object (remember that everything in Mathematica is a list of lists):
rands=RandomReal[1, 1000];
pts=SmoothHistogram[rands][[1, 2, 1, 3, 3, 1]]
ListPlot[pts]
x
, then you can generate a list of points withskd = SmoothKernelDistribution[x]; Table[{y, PDF[skd, y]}, {y, 0, 10, 0.01}]
(but adjusting they
values to match what you need). That way you have explicit control as to the values ofy
that you want the pdf to be evaluated. $\endgroup$ – JimB Nov 21 '17 at 15:50