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
 Curve fitting
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Biotec12

Armenia
8 Posts

Posted - 06/30/2011 :  04:52:14 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Dear friends,

I am trying to fit a curve to a data points using Origin 7.

here are my data points

0 0
3.34303E-6 8.537E-8
4.66962E-6 1.2195E-7
5.99623E-6 1.7073E-7
7.32282E-6 2.561E-7
8.64942E-6 3.2927E-7
9.97601E-6 3.9146E-7
1.13026E-5 5.0122E-7
1.26292E-5 5.8659E-7
1.39558E-5 6.7317E-7
1.52824E-5 7.9634E-7
1.6609E-5 8.9512E-7
1.79356E-5 1.01098E-6
1.90499E-5 1.10976E-6

and here is the function to which I want to fit

C*(sin(k*x)-(A/(2.796*10^-29*k))*(1+(sin(k*19.05*10^-6)-(A/(2.796*10^-29*k))*cos(k*19.05*10^-6)-(A/2.796*10^-29*k))*cosh(k*19.05*10^-6))/(sinh(k*19.05*10^-6)+(A/(2*(1.398*10^-29)*k))*cos(k*19.05*10^-6)+(A/(2*(1.398*10^-29)*k))*cosh(k*19.05*10^-6)))*cos(k*x)+((sin(k*19.05*10^-6)-(A/(2.796*10^-29*k))*cos(k*19.05*10^-6)-(A/2.796*10^-29*k))*cosh(k*19.05*10^-6))/(sinh(k*19.05*10^-6)+(A/(2*(1.398*10^-29)*k))*cos(k*19.05*10^-6)+(A/(2*(1.398*10^-29)*k))*cosh(k*19.05*10^-6)))*sinh(k*x)+(A/(2.796*10^-29*k))*(1+(sin(k*19.05*10^-6)-(A/(2.796*10^-29*k))*cos(k*19.05*10^-6)-(A/2.796*10^-29*k))*cosh(k*19.05*10^-6))/(sinh(k*19.05*10^-6)+(A/(2*(1.398*10^-29)*k))*cos(k*19.05*10^-6)+(A/(2*(1.398*10^-29)*k))*cosh(k*19.05*10^-6)))*cosh(k*x))

Fitting constants are A,k and C

initial values are A = 7.31707*10^-24; k =862467 and C =2.7385*10^8

I am getting message:

Unable to compile user defined function

I will really appreciate if you will help me to fit the curve, using even two parameters k and A will be enough for me just delete C from formula.

Best

Hideo Fujii

USA
1582 Posts

Posted - 06/30/2011 :  10:23:01 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Biotec12,

First of all, it seems your formula's parentheses don't match (if my checking is correct).
Also, as your function form doesn't have the left-hand side with the dependent variable like "y=", check that the form of the fit function is "Expression"; However, I strongly suggest to set the form to "Origin C" rather than "Expression" for such a complected function so that you can divide your function into the combination of multiple terms - to avoid the parenthesis mismatch and easy to maintain. (Also, since 19.05*10^-6 seems to be a common constant in your function, it would improve the readability if you define it as a constant.)

--Hideo Fujii
OriginLab

Edited by - Hideo Fujii on 06/30/2011 10:25:17 AM
Go to Top of Page

easwar

USA
1965 Posts

Posted - 06/30/2011 :  11:31:45 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Also change numbers such as "19.05*10^-6" to "19.05E-6", this was an issue in older versions in OC functions.

Easwar
OriginLab
Go to Top of Page

Biotec12

Armenia
8 Posts

Posted - 06/30/2011 :  2:58:08 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks a lot for reply however, I am still getting same massage

Unable to compile user defined function

y=C*(sin(k*x)-(A/(2.796E-29*k))*(1+(sin(k*19.05E-6)-(A/(2.796E-29*k))*cos(k*19.05E-6)-(A/2.796E-29*k))*cosh(k*19.05E-6))/(sinh(k*19.05E-6)+(A/(2*(1.398E-29)*k))*cos(k*19.05E-6)+(A/(2*(1.398E-29)*k))*cosh(k*19.05E-6)))*cos(k*x)+((sin(k*19.05E-6)-(A/(2.796E-29*k))*cos(k*19.05E-6)-(A/2.796E-29*k))*cosh(k*19.05E-6))/(sinh(k*19.05E-6)+(A/(2*(1.398E-29)*k))*cos(k*19.05E-6)+(A/(2*(1.398E-29)*k))*cosh(k*19.05E-6)))*sinh(k*x)+(A/(2.796E-29*k))*(1+(sin(k*19.05E-6)-(A/(2.796E-29*k))*cos(k*19.05E-6)-(A/2.796E-29*k))*cosh(k*19.05E-6))/(sinh(k*19.05E-6)+(A/(2*(1.398E-29)*k))*cos(k*19.05E-6)+(A/(2*(1.398E-29)*k))*cosh(k*19.05E-6)))*cosh(k*x))
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 06/30/2011 :  3:42:41 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

I have counted ('s and )'s. There are 63 ('s and 66 )'s. So, obviously parentheses are not matched. Again, I suggest you to divide it to multiple terms.

--Hideo Fujii
OriginLab
Go to Top of Page

Biotec12

Armenia
8 Posts

Posted - 07/03/2011 :  10:01:55 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks a lot I correct the parentheses, now I am getting large error bars

Data: Data1_D
Model: user2
Weighting:
y No weighting

Chi^2/DoF = 5.5384E-16
R^2 = 0.99639

k 7.75826 +-19653.00291
A 7.5527E-18 +-2.303E-14
C 547047.41189 +-4178111280.25768

do you have any idea what could be the problem ?
Go to Top of Page

Biotec12

Armenia
8 Posts

Posted - 07/05/2011 :  04:29:19 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Pleas reply.
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 07/05/2011 :  4:25:06 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

I suspect that your initial parameter values are not good enough to give a reasonably close curve to start fitting your data. You can see the curve of the current parameter values on the graph by pressing "Chi^2" button in NLFit tool, or you can use the "Simulate" button in the Fitting Function Organizer to evaluate the parameter values. In many cases with a user-defined function, the divergence is the result of not-good-enough initial parameter values.

--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