Hi,
Please check the following OC code for defining your fitting function, you will need to set Function Type to Origin C:
void _nlsfAxe(
// Fit Parameter(s):
double k, double l, double M,
// Independent Variable(s):
double x,
// Dependent Variable(s):
double& y)
{
const double n2=2;
const double nc=2;
// Beginning of editable part
double Cp = l^2/(2*k^2);
double Cm = -l^2/(2*k^2);
double ki = sqrt(2*k^2/(n2*(n2+1))+2*l^2/nc);
double kip = sqrt(ki^2-4*Cp*Cm*k^2);
double Bp = (ki+kip)/2/k;
double Bm = (ki-kip)/2/k;
y = M*(1-((Bp+Cp)/(Bp+Cp*exp(k*x))*(Bm+Cp*exp(k*x))/(Bm+Cp))^(ki^2/k/kip^2)*exp(-ki/k));
// End of editable part
}
Please also contact <tech@originlab.com> if you need further help. Thank you.
James