[General Information]
Function Name=Power2D
Brief Description=Non-Linear Power Function
Function Source=fgroup.Power2D
Function Type=Built-in
Function Form=Expression
Number Of Parameters=6
Number Of Independent Variables=2
Number Of Dependent Variables=1
Analytical Derivatives for User-Defined=Off


[Fitting Parameters]
Naming Method=User-Defined
Names=z0,B,C,D,E,F
Meanings=offset,
Initial Values=--(V)
Lower Bounds=--(X, OFF)
Upper Bounds=--(X, OFF)
Number Of Significant Digits=


[Formula]
z = z0 + B*pow(x, C) + D*pow(y, E) + F*pow(x, C)*pow(y, E);


[Constraints]



[Constants]


[Parameters Initialization]

Curve x_curve, y_curve;
bool bRes = get_interpolated_xz_yz_curves_from_3D_data(x_curve, y_curve, x_data, y_data, z_data);
if(!bRes) return;

double Zx1, Zx2, Zy1, Zy2;	// Zx75, Zx50, Zy75, Zy50
double x1, x2, y1, y2;		// x75,  x50,  y75,  y50
Zx1 = y75( x_curve);
Zx2 = y50( x_curve);
x1 = Curve_xfromY(&x_curve, Zx1);
x2 = xaty50( x_curve );

Zy1 = y75( y_curve );
Zy2 = y50( y_curve );
y1 = Curve_xfromY(&y_curve, Zy1);
y2 = xaty50( y_curve );

z0 = 0.5 *( Curve_yfromX(&x_curve, 0.0) + Curve_yfromX(&y_curve, 0.0) );
if( z0 == NANUM ) z0 = 0.0;

C = ln( fabs( (Zx1-z0)/(Zx2-z0) ) ) / ln(fabs(x1/x2)); 
if( C == NANUM ) C = 1.0;

B = 0.15 * ( (Zx2-z0) / pow(x2,C) + (Zx1-z0) / pow(x1,C) );
if( B == NANUM ) B = 1.0;

D = ln( fabs( (Zy1-z0)/(Zy2-z0) ) ) / ln(fabs(y1/y2)); 
if( D == NANUM ) D = 1.0;

E = 0.15 * ( (Zy2-z0) / pow(y2,C) + (Zy1-z0) / pow(y1,C) );
if( E == NANUM ) E = 1.0;

F = 0.5*(B + D);

[Initializations]



[After Fitting]



[On Param Change]



[Independent Variables]
x=
y=


[Dependent Variables]
z=


[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
Enable Parameters Initialization=0
Compile On Param Change Script=1


[Compile Function]
Compile=0
Compile Parameters Initialization=1
On Param Change Scripts Enabled=N/A


[Origin C Function Header]



[Origin C Parameter Initialization Header]
#include <origin.h>
#include <Nag_utils.h>



