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
 "invalid" in Fitting Function 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

HAYAO

Japan
10 Posts

Posted - 07/06/2017 :  10:30:38 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
OriginPro 2017
OS: Windows 10 (64bit)

Dear all,

I am having problem creating new fitting function:
y = D*A^2*((E*(2B-C+2*(B^2-B*C)^(1/2))*x)^(-1/2))*exp(-B/F*x)

Here, D, E, and F are constants, and C is going to be a fix parameter.

This is supposed to be the equation for electron transfer rate constant by Marcus theory. So each of D, E, and F is a parameter given by constants such as Planck constant, Boltzmann constant, etc.

D = 5.957884797*10^27 (cm-2 g-1 s)
E = 1.735038791*10^-15 (cm2 g s-2 K-1)
F = 1.3807*10^-16 (cm2 g s-2 K-1)

However, when I press "Next>>", it says that "D = 5.957884797*10^27 invalid"

I don't know what is invalid about these parameters. I cannot move on because of this. Could someone help me what I am doing wrong?

Some extra information
Independent variable: x
dependent variable: y
Parameters : A, B, C
Constants : D, E, F
Function model: Explicit
Function type: Expression

Thank you,

HAYAO

Edited by - HAYAO on 07/06/2017 10:34:01 PM

yuki_wu

896 Posts

Posted - 07/07/2017 :  01:37:25 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi HAYAO,

In Origin, the scientific notation should be displayed like 1E3, so D = 5.957884797*10^27 should be D = 5.957884797E27.

If you want to know more about how numeric values are handled in Origin, please go to this page:
http://originlab.com/doc/Origin-Help/Number-in-Origin

Hope it helps.

Regards,
Yuki
OriginLab
Go to Top of Page

HAYAO

Japan
10 Posts

Posted - 07/07/2017 :  03:38:18 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you yuki_wu, but now the equation won't fit.

It gives an error "Fit did not converge - reason unknown".
It didn't even do one iteration.


The function file looks like this:

[General Information]
Function Name = MarcusFinal3
Brief Description =
Function Source = N/A
Number Of Parameters = 3
Function Type = User-Defined
Function Form = Expression
Path =
Number Of Independent Variables = 1
Number Of Dependent Variables = 1
FunctionModel = Explicit

[Fitting Parameters]
Names = A,B,C
Initial Values = 1(V),1(V),1(V)
Meanings = ?,?,?
Lower Bounds = --(I, Off),--(I, Off),--(I, Off)
Upper Bounds = --(I, Off),--(I, Off),--(I, Off)
Naming Method = User-Defined
Number Of Significant Digits = 0,0,0
Unit = ,,
Format = --,--,--
CustomDisplay = --,--,--

[Independent Variables]
x =

[Dependent Variables]
y =

[Formula]
D*A^2*((E*(2B-C+2*(B^2-B*C)^(1/2))*x)^(-1/2))*exp(-B/F*x)

[Constraints]

[Initializations]

[After Fitting]

[Constants]
D=5.957884797e+027
E=1.735038791e-015
F=1.3807e-016

[Controls]
General Linear Constraints = 0
Initialization Scripts = off
Scripts After Fitting = off
Number Of Duplicates = N/A
Duplicate Offset = N/A
Duplicate Unit = N/A
Generate Curves After Fitting = Yes
Curve Point Spacing = Uniform on X-Axis Scale
Generate Peaks After Fitting = Yes
Generate Peaks During Fitting = Yes
Generate Peaks with Baseline = Yes
Paste Parameters to Plot After Fitting = Yes
Paste Parameters to Notes Window After Fitting = Yes
Generate Residuals After Fitting = No
Keep Parameters = No
Compile On Param Change Script = 1
Enable Parameters Initialization = 1
Treat All Numbers As Double = on
Use Initial Formula = 1
AllowInitializingFixedParameters = 0

[Compile Function]
Compile = 0
Compile Parameters Initialization = 1
OnParamChangeScriptsEnabled = 0

[Parameters Initialization]

[Origin C Function Header]

[Origin C Parameter Initialization Header]

[Derived Parameter Settings]
Unit =
Names =
Meanings =
Go to Top of Page

yuki_wu

896 Posts

Posted - 07/07/2017 :  06:24:03 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

I think this page can help, please have a look:
http://www.originlab.com/doc/Origin-Help/The_Reason_Why_Fail_to_Converge

Regards,
Yuki
OriginLab
Go to Top of Page

HAYAO

Japan
10 Posts

Posted - 07/07/2017 :  1:16:06 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello, thank you, but I have already visited that page before.

None of the reason seems to apply for my case.

1) Since the equation above is similar to y = A*exp(-B/x), I have used this equation and used the parameters as rough initial values. However, even with the initial value, Origin did not even attempt one cycle of iteration.

2) The equation does not have a minima or maxima.

3) The equation is not over-parameterized. The reason the equation looks complicated is exactly to prevent over-parameterization.

4) The data should be fine as it has been done in previous reports. Only except, none of them explains how exactly (with what method) the fitting was done.


I once again stress that not even one iteration was done. I think this is more of a fundamental problem than a data/equation problem.
Go to Top of Page

yuki_wu

896 Posts

Posted - 07/09/2017 :  10:12:59 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Is the exponent greater than 665? If yes, you need to redefine the equations to avoid the exponent value of the exp(x) function from greater than 665. Please take a look at this quick help for more help:
http://www.originlab.com/doc/Quick-Help/ExponentialFit-not-Converging

Regards,
Yuki
OriginLab
Go to Top of Page

HAYAO

Japan
10 Posts

Posted - 07/09/2017 :  10:56:55 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you Yuki_wu,

No, the exponential part will reach maximum of 1.8x10^-3, minimum of 1.8x10^-11
Go to Top of Page

yuki_wu

896 Posts

Posted - 07/10/2017 :  04:53:21 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

For most of users, the reasons why the fit fails to converge is the incorrect initial value and the incorrect model.

I would suggest:
1. Press F9 to open the Fitting Function Organizer dialog
2. Select the fitting function you defined in the left panel
3. Click Simulate button in the right panel
4. Type the initial values in Parameters item
5. Set the range of X data
6. Click Preview button to check the curve preview

You may easy to see if the curve is similar to your data this time. What’s more, you can click OK button to get the simulated dataset. If your data is very different from the simulated data, please try to review your fitting model once more.

If you feel everything looks good but still you cannot fix the problem, you can send us your data via tech@originlab.com so that we can try to figure out what went wrong.

Regards,
Yuki
OriginLab
Go to Top of Page

HAYAO

Japan
10 Posts

Posted - 07/10/2017 :  09:03:55 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you.

It seems like the preview won't even work. It doesn't plot anything.
Go to Top of Page

yuki_wu

896 Posts

Posted - 07/10/2017 :  10:19:49 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Yes, there must be something wrong with your fitting function if the preview cannot be seen.

I helped to modify your function:
y = D * A^2 * ((E * (2*B – C + 2*(B^2 - B*C)^(1/2)) *x) ^ (-1/2)) * exp(-B/F*x)

Please review your fitting function carefully again and then refine initial values to better follow your data. Just like what I mentioned before, most of the reasons why the fit fails to converge is the incorrect initial value and the incorrect model.

Regards,
Yuki
OriginLab
Go to Top of Page

HAYAO

Japan
10 Posts

Posted - 10/19/2017 :  10:33:30 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by yuki_wu

Hi,

Yes, there must be something wrong with your fitting function if the preview cannot be seen.

I helped to modify your function:
y = D * A^2 * ((E * (2*B – C + 2*(B^2 - B*C)^(1/2)) *x) ^ (-1/2)) * exp(-B/F*x)

Please review your fitting function carefully again and then refine initial values to better follow your data. Just like what I mentioned before, most of the reasons why the fit fails to converge is the incorrect initial value and the incorrect model.

Regards,
Yuki
OriginLab




Sorry I have been busy and could not get back to this.

I carefully checked everything and it still does not work.
The initial parameters have also been carefully checked.
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 10/20/2017 :  10:02:44 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi HAYAO,

> y = D * A^2 * ((E * (2*B – C + 2*(B^2 - B*C)^(1/2)) *x) ^ (-1/2)) * exp(-B/F*x)

Inconspicuous, but it seems the minus sign in "2*B – C" is not a regular "dash", but an "en dash" (longer than regular dash(-)).
Try (as defined as Function Type=OriginC):
y = D * A^2 * ((E * (2*B - C + 2*(B^2 - B*C)^(1/2)) *x) ^ (-1/2)) * exp(-B/F*x);
Hope it works this time.

--Hideo Fujii
OriginLab

P.S. I found this error by going to the Code Builder from Fit Function Builder, then pressed "Compile" button.

Edited by - Hideo Fujii on 10/20/2017 10:09:35 AM
Go to Top of Page

HAYAO

Japan
10 Posts

Posted - 10/22/2017 :  2:42:32 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Dear Fujii,

Thank you, but it seems like that didn't really matter. It still says fitting error - reasons unknown even after I fixed the equation.

I was suspecting that perhaps the scale of the constants I am using is a bit too extreme. So I converted the units from cgs to SI units, and this time it worked.

Thank you.
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