[General Information]

Function Name=Power2	; name show up in the select function dialog
Brief Description=Asymmetric Power function
Function Type=Built-in		; source type, built-in, user-defined, external dll
Function Form=Expression	; function form;
Function Source=fgroup.Power2
Number Of Parameters=4
Number Of Independent Variables=1
Number Of Dependent Variables=1


[Fitting Parameters]

Naming Method=user-defined
Names=xc,A,pl,pu
Lower bounds=--,0.0(X,ON),0.0(X,ON),0.0(X,ON)
Upper bounds=--,--,--,--
Meanings=center,amplitude,power,power


[Independent Variables]

x = 


[Dependent Variables]

y = 


[Constants]


[Formula]

y = A*|x-xc|^pl,  if x<xc
y = A*|x-xc|^pu,  if x>xc

[Constraints]


[Parameters Initialization]
sort(x_y_curve);
smooth(x_y_curve);
xc=xatymin(x_y_curve);  	
double xc_index=Data_list(xc,&x_data);
x_y_curve = ln(x_y_curve);
Dataset dx;
x_y_curve.AttachX(dx);
dx = ln(fabs(dx-xc));
double coeff[2];
// fit from LowerIndex to xc_index   	
fitpoly_range(x_y_curve,x_y_curve.GetLowerIndex(),xc_index,1,coeff); 
A=exp(coeff[0]);
pl=coeff[1];
// fit from xc_index to UpperIndex
fitpoly_range(x_y_curve,xc_index,x_y_curve.GetUpperIndex(),1,coeff);
pu=coeff[1];

[Initializations]


[After fitting]


[Controls]
General Linear Constraints=Off
Initialization scripts=Off
Scripts After fitting=Off

