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
 All Forums
 Origin Forum
 Origin Forum
 Problem with user defined fitting functions

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
GoldenTooth Posted - 04/09/2019 : 07:42:11 AM
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?

2   L A T E S T    R E P L I E S    (Newest First)
GoldenTooth Posted - 04/09/2019 : 11:05:24 AM
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!
YimingChen Posted - 04/09/2019 : 10:33:31 AM
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

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000