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
 Problem with user defined fitting 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

GoldenTooth

Poland
2 Posts

Posted - 04/09/2019 :  07:42:11 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. OriginPro 2019 (64-bit) and OriginPro 7.5
Operating System:Windows 10 Pro

Hi,
I am using two Origin versions. Few years ago I developed several fitting funcs on my OriginPro 7.5. You may find an example of function enclosed to the post as .png image. I have tried today to import my functions to newly installed OriginPro 2019 but they are not working properly. Builder compiles created funcs (attached image) but unfortunatelly I am not able to simulate or fit data points. I received message "Function contains multiple independent and dependent variables and can not do sim.". I tried to rewrite and change the code and I realized that the problem is related to more then one dependent variable that I used in the func. The point is that in some developed in the past funcs I am not able to reduce the number of dependent variables to one. Am I doing something wrong? Can someone help me wit that issue?

YimingChen

1609 Posts

Posted - 04/09/2019 :  10:33:31 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

In the definition of your function, you only need one dependent variable which is y. Please quit code builder, and go to previous page in Fitting Function Builder dialog, set Dependent Variables to y. See if it's the issue. Thanks.

James
Go to Top of Page

GoldenTooth

Poland
2 Posts

Posted - 04/09/2019 :  11:05:24 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks a lot. I've made it as you suggested and I moved the declaration of the other variables to the function as follows:

void _nlsfstep_3(
// Fit Parameter(s):
double fd1, double sig1, double fd2, double sig2, double fd3, double sig3, double ix2,
double ix3,
// Independent Variable(s):
double x,
// Dependent Variable(s):
double& y)
{
// Beginning of editable part
double t1,t2,t3,R1,R2,R3;


t1=fd1*(1-exp(-sig1*x));
t2=(fd2-fd1)*(1-exp(-sig2*(x-ix2)));
t3=(fd3-fd2)*(1-exp(-sig3*(x-ix3)));

if (t1<0)
R1=0;
else
R1=t1;
if (t2<0)
R2=0;
else
R2=t2;
if (t3<0)
R3=0;
else
R3=t3;
y=R1+R2+R3;

Works great! Thanks once again!
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