The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Fit building with multiple coefficent-functions
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

AxelSve

2 Posts

Posted - 07/26/2018 :  09:18:40 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. 2016
Operating System: Windows

Hello everyone,

I want to fit my data to a non-linear fit-function that is rather long (see attached file).

My background in programming is yet extremely low and I was wondering if there is a possibility to integrate the different functions of the coefficients (C+, B+, ...) into my equotation M(t) using the Fitting function builder. For example including a initializing script function before running the fit. The fitted parameters from that model are only kappa and lambda, whereby n2=nc=2.

Nevertheless I have failed so far to come up with a good solution.

Thank you very much for your help!
Axel

YimingChen

1623 Posts

Posted - 07/26/2018 :  09:52:27 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

AxelSve

2 Posts

Posted - 07/26/2018 :  11:11:01 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi James,

thank you for the fast answer!
I will try to work it out!

Best,
Axel
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000