example of fitting a 3D function Typical multidimensional parametric regression where the predictor depends on 3 variables
In the case of 1 or 2D one can use the TGraph classes but since no TGraph3D class exists this tutorial provide an example of fitting 3D points
Processing /builddir/build/BUILD/root-6.12.06/tutorials/fit/exampleFit3D.C...
****************************************
Minimizer is Minuit / Migrad
Chi2 = 993.065
NDf = 997
Edm = 1.13148e-19
NCalls = 43
p0 = 0.993546 +/- 0.00475134
p1 = 0.99397 +/- 0.00434249
p2 = 0.997895 +/- 0.000545663
Good fit : p-value = 0.529221
void exampleFit3D() {
double ev = 0.1;
for (
int i = 0; i <
n; ++i) {
}
double xx[3];
for(
int i = 0; i <
n; ++i) {
}
TF3 * f3 =
new TF3(
"f3",
"[0] * sin(x) + [1] * cos(y) + [2] * z",0,10,0,10,0,10);
if (ret) {
double prob = res.
Prob();
Error(
"exampleFit3D",
"Bad data fit - fit p-value is %f",prob);
else
std::cout << "Good fit : p-value = " << prob << std::endl;
}
else
Error(
"exampleFit3D",
"3D fit failed");
}
- Author
- Lorenzo Moneta
Definition in file exampleFit3D.C.