[General Information]
Function Name = Weibull
Brief Description = Weibull function
Function Source = fgroup.Weibull
Number Of Parameters = 4
Function Type=Built-in
Function Form = Equation
Number Of Independent Variables = 1
Number Of Dependent Variables = 1

[Fitting Parameters]
Names = y0,a,r,u
Initial Values = --(V), --(V), --(V), --(V),
Meanings = y offset,scale,shape,location
Lower Bounds = --(X, Off),0.0(X, On),0.0(X, On),--(X, Off)
Upper Bounds = --(X, OFF)
Naming Method = User-Defined
Number Of Significant Digits = 

[Independent Variables]
x = 


[Dependent Variables]
y = 

[Formula]
double temp = (x-u)/a;
y = y0 + (r/a) * pow( temp, (r-1) ) * exp( -pow( temp, r ) );



[Constraints]




[Initializations]




[After Fitting]




[Constants]

[Controls]
General Linear Constraints = off
Initialization Scripts = off
Scripts After Fitting = off
Number Of Duplicates = N/A
Duplicate Offset = N/A
Duplicate Unit = N/A
Generate Curves After Fitting = Yes
Curve Point Spacing = Uniform on X-Axis Scale
Generate Peaks After Fitting = Yes
Generate Peaks During Fitting = Yes
Generate Peaks with Baseline = Yes
Paste Parameters to Plot After Fitting = Yes
Paste Parameters to Notes Window After Fitting = Yes
Generate Residuals After Fitting = No
Keep Parameters = No
Compile On Param Change Script = 1
Enable Parameters Initialization = 1

[On Parameter Change]




[Compile Function]
Compile = 1
Compile Parameters Initialization = 1.
OnParamChangeScriptsEnabled = 0.

[Parameters Initialization]
int nSize = x_data.GetSize();
vector vX(nSize), vY(nSize), vCoeff(2), vInteg(nSize);
sort(x_y_curve);
y0 = min ( y_data );
u = min ( x_data );
y_data = y_data - y0;
IntegrationResult result;
/// Fisher 07/06/09	WEIBULL_INIT_CODE_MAKE_ORIGIN_CRASH
//int nRet = ocmath_integrate( x_data, y_data, 0, nSize, &result, vInteg );
int nRet = ocmath_integrate( x_data, y_data, 0, nSize-1, &result, vInteg );
/// End  WEIBULL_INIT_CODE_MAKE_ORIGIN_CRASH
vY = ln( -ln( 1 - vInteg ) );
vX = ln( x_data );
Curve crv( vX, vY );
fitpoly( crv, 1, vCoeff);
r = vCoeff[1];
a = exp( -vCoeff[0]/vCoeff[1] );


[Origin C Function Header]




[Origin C Parameter Initialization Header]




[DerivedParameters]
