public class ModelData extends java.lang.Object
Modified by: Joseph A. Huwaldt
Constructor and Description |
---|
ModelData() |
Modifier and Type | Method and Description |
---|---|
static double |
fit(double[] xarr,
double[] yarr,
double[] sig,
BasisFunction func,
double[] coef)
Method that returns the coefficients of an arbitrary basis function that best
models or "fits" the supplied data values in a minimization of chi-squared sense.
|
static double |
linearSlope(double[] x,
double[] y)
Returns the slope of the line formed by a linear regression through the specified
data arrays.
|
static void |
main(java.lang.String[] args)
Used to test the methods in this class.
|
static double |
polynomial(double[] xarr,
double[] yarr,
double[] coef)
Method that returns the coefficients of a polynomial of the specified degree that
best models or "fits" the supplied data values in a minimization of chi-squared
sense.
|
static double |
polynomial(double[] xarr,
double[] yarr,
double[] sig,
double[] coef)
Method that returns the coefficients of a polynomial of the specified degree that
best models or "fits" the supplied data values in a minimization of chi-squared
sense.
|
public ModelData()
public static double polynomial(double[] xarr, double[] yarr, double[] coef) throws RootException
xarr
- Array of independent parameter data values to fit.yarr
- Array of dependent data values (associated with each X value) to be modeled.coef
- An existing array that will be filled in with the coefficients of the
polynomial, in decreasing power that best fits the sample data. Example: p(x) = A +
B*x + C*x^2 + D*x^3 + E*x^4 corresponds to coef[] = {A, B, C, D, E}. The number of
elements in the coef array determines the order of the polynomial created. Number
of elements be greater than 1.RootException
public static double polynomial(double[] xarr, double[] yarr, double[] sig, double[] coef) throws RootException
xarr
- Array of independent parameter data values to fit.yarr
- Array of dependent data values (associated with each X value) to be modeled.sig
- Array of individual standard deviations for each data point.coef
- An existing array that will be filled in with the coefficients of the
polynomial, in decreasing power that best fits the sample data. Example: p(x) = A +
B*x + C*x^2 + D*x^3 + E*x^4 corresponds to coef[] = {A, B, C, D, E}. The number of
elements in the coef array determines the order of the polynomial created. Number
of elements be greater than 1.RootException
public static double fit(double[] xarr, double[] yarr, double[] sig, BasisFunction func, double[] coef) throws RootException
xarr
- Array of independent parameter data values to fit.yarr
- Array of dependent data values (associated with each X value) to be
modeled.sig
- Array of individual standard deviations for each data point.func
- The basis function used to generate the data fit.coef
- An existing array that will be filled in with the coefficients of the
basis function that best fits the data.RootException
public static double linearSlope(double[] x, double[] y)
x
- The independent array of data points.y
- The dependent array of data points (must be the same size as the x array.public static void main(java.lang.String[] args)