**'joptima.ChiSquaredFitter2D'**Java class

joptima

## Class ChiSquaredFitter2D

- java.lang.Object
- joptima.Fitter
- joptima.ChiSquaredFitter2D

- All Implemented Interfaces:
- Function, Minimizable

public class ChiSquaredFitter2Dextends Fitter

χ² fitter. This class can be passed to a

`Minimizer`

to minimize χ² of a sum of one or more functions fit to the given two-dimensional data set. Error bars may be provided for the data points if the data has compounded errors that are Gaussian. sqrt(z) errors are assumed otherwise.Note that the usual two-dimensional matrix of values is passed to this function unfolded into a single array, i.e. the (x[i], y[i], z[i]) tuple for an m by n histogram where z = f(x, y) will have indices running from 0 through m * n - 1.

A typical usage of this class would go as follows:

// The data points. double[] x = new double[]{ 1, 2, 3, 1, 2, 3, 1, 2, 3}; double[] y = new double[]{ 1, 1, 1, 2, 2, 2, 3, 3, 3}; double[] z = new double[]{1.1, 4.0, 8.7, 3.9, 16, 24, 9.2, 22, 38}; // The

`Function`

to fit to the data points. Function2D f = new Sum2D(new Quadratic(), new Quadratic); ChiSquaredFitter2D fitter = new ChiSquaredFitter2D(); fitter.setData(x, y, z); fitter.addFunction(f); Minimizer.minimize(fitter); // At this point, if the fit converged, the`Function`

f will have // its`Parameter`

s set to the optimal values.

**Warning:**You cannot see the full API documentation of this class since the access to the DatMelt documentation for third-party Java classes is denied. Guests can only view jhplot Java API. To view the complete description of this class and its methods, please request the full DataMelt membership.

If you are already a full member, please login to the DataMelt member area before visiting this documentation.