Fitting 2D data

Hi all,

I’m having a few problems knowing where to start in order to fit some of my data. I have a few hundred points in (X and Y) that lie on the perimeter of an ellipse. I would like to try to apply some sort of fit to this data so that I can get parameters of the ellipse (i.e. the center and semiminor and semimajor axis lengths).

I’ve tried following fit2d.C in the tutorials by creating my own TF2 function for a simple ellipse, but I don’t seem to get anything that works.

Eventually I would want to extend this so that I could fit an elliptical area around a given set of points in a scatter plot.

Any ideas?

Cheers,
John

Hi,

the way to solve your problem is to write a function which calculates the distance between a point P(x,y) and a generic ellipse E(a1,a2,center),
You then construct a chisquared which is the sum of the squared of the distance divided by their error squared and you minimize this using MINUIT. You need to calculate the error on the distance using error propagation from the point error.

An Example in ROOT to use MINNUIT for minimizing a function is in :

root.cern.ch/root/html/examples/Ifit.C.html

Please let me know if you need further information,

Best Regards

Lorenzo