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
 User defined function: code builder
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

yjiean

USA
10 Posts

Posted - 11/03/2011 :  2:57:32 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi

I am trying to create a user defined equation to fit my data points. The equation is
F=F0/((1+Kd*Q)(exp(Q*v*6.02E23/1000)))+sc*Q
where F is the dependent variable, Q the independent variable and the rest are parameters. I have having trouble compiling the equation in code builder: it returns 'Error, function or variable (1+Kd*Q) not found'. The aim is to get a value for the parameter Kd, v and sc.

I would be grateful if someone could point out what I am doing wrong. Or if there is another easier way of doing this. Thanks in advance.

Hideo Fujii

USA
1582 Posts

Posted - 11/03/2011 :  3:36:49 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi yjiean,

At least, I see that a multiplication * between ...Kd*Q) and (exp(Q... is missing.

--Hideo Fujii
OriginLab

P.S. exp(Q*v*6.02E23/1000) part may quite easily overflow the range of double variable, though this is not a mathematical issue, but rather practical. Exp(666) results overflowing.

Edited by - Hideo Fujii on 11/03/2011 3:54:00 PM
Go to Top of Page

yjiean

USA
10 Posts

Posted - 11/03/2011 :  4:06:20 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Hideo

Thank you for your help.
The function compiled but I am still not able to get it to work.
I am now trying with a simple y=x+A to find the problem. When I tried to Analysis>Fitting>Nonlinear Curve Fit, the user defined y=x+A did not fit to the points. Am I doing something wrong?

Under the fitting function organizer, the function type: user defined; Function form: Origin C. Is there something I should be doing with the parameter initialization? Many thanks.

yjiean

quote:
Originally posted by Hideo Fujii

Hi yjiean,

At least, I see that a multiplication * between ...Kd*Q) and (exp(Q... is missing.

--Hideo Fujii
OriginLab

Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 11/03/2011 :  4:29:58 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi yjiean,

I suspect that when the fitting process started, the parameter(A's) value was not given as "missing". If you created the user-defined function by Fitting Function Builder, all parameters are given the value 1.0 as default. If you created the function by Fitting Function Organizer, say as you are using an old Origin version which don't provide the Builder, you can give the initial values by pressing the "sheet with a red pointer" button at the Parameter Settings field in the Organizer. Or, when you start NLFit, choose the "Parameters" tab, and give the "reasonable" parameter initial values manually.

I hope my suggestion is helpful.

--Hideo Fujii
Originlab
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