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

RibeiroS

Portugal
3 Posts

Posted - 04/25/2017 :  5:21:32 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hey guys,

I´m trying to make a non-linear fitting with this function (exp((-a * (b-x))/R*T))/(1+ exp((-a * (b-x))/R*T)). However when i do the quick check, y value is always 0, independent of x value. I defined R and T as constans(values were assigned). Do you have any idea why this is happening?
Thank you very much!


Sara

cc261

22 Posts

Posted - 04/25/2017 :  11:34:55 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
It is better to give out your data.
Go to Top of Page

yuki_wu

896 Posts

Posted - 04/26/2017 :  03:09:06 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Sara,

I tried your example on my machine, but everything looked fine for me. I set R =1 and T=1:
1. Open Fitting Function Organizer dialog (press F9)
2. Find this user-defined function in the left panel
3. Click Simulate button in the right panel

Did you want to build a fitting function as what I showed?

Go to Top of Page

RibeiroS

Portugal
3 Posts

Posted - 04/27/2017 :  07:13:58 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Dear yuki,

Thank you very much. I tried what you suggested but it gave a horizontal line (y=0). Then i changed the a parameter value (initial value of 2000) to 1 and it worked. However, a value should be fitted between 5000 and 8000 and was fitted to 0,08. Do you have any ideia on why this may happen?
Thank you again for your help!

Sara

Edited by - RibeiroS on 04/27/2017 07:18:14 AM
Go to Top of Page

yuki_wu

896 Posts

Posted - 04/28/2017 :  04:11:48 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Sara,

Let us simplify your fitting model:

so that we can calculate:

If you set the parameters a and b with a large value that is much larger than x value (while R=1 and T=1), A always tends to 0. Thus, you will see a line y=0.

To check the value of A, I have a tip:
1. Select Window: Script Window form Origin menu
2. In Script Window, type your formula directly
3. Add an equal sign “=” at the end of your formula, and then hit Enter key
4. The result will be printed on the dialog


Yuki
OriginLab

Edited by - yuki_wu on 04/28/2017 04:15:53 AM
Go to Top of Page

RibeiroS

Portugal
3 Posts

Posted - 04/28/2017 :  9:02:10 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Yuki,

Thank you very much once again for the help. Indeed, what you referred makes perfect sense! I triyed what you suggested and y was equall to zero. To compare i did the same fit in excell using Solver. With this last one, m values were between 6000 and 8000, b values between 5-6, and R T values are the gas constant (8,3144) T is temperature (303,15).You have any idea why it worked in the last case?
Sorry for the hard work and thank you once again!

sara

Edited by - RibeiroS on 04/28/2017 9:11:37 PM
Go to Top of Page

yuki_wu

896 Posts

Posted - 05/02/2017 :  03:29:11 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Sara,

I might not understand your question this time.

1. Did you mean that you get the fitting result in Excel?
2. The m is the variable a that you mentioned before, right?
3. Did you ask for how to get the result (m=6000-8000, b=5-6, R=8.3144, T=303.15)?

Please post more details, and you can upload an screenshot which may help me understand easily.

Yuki
OriginLab
Go to Top of Page

RibeiroS

Portugal
3 Posts

Posted - 05/02/2017 :  09:23:36 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Dear Yuri,

Sure, im really sorry for being confusing. I did the fitting in excell, a is m (you right) and the results are described bellow (in the screenshot). I would like to do this fitting on origin, but have the problems that we discussed above. My question is if you have any idea why in origin this is not working.
Please tell me if im not clear enough!
Note: C is x and experimental values is y

Thank you very much and im sorry once again!

Sara

Edited by - RibeiroS on 05/02/2017 09:29:28 AM
Go to Top of Page

arstern

USA
237 Posts

Posted - 05/02/2017 :  10:08:47 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Sara,

I was able to create a fitted curve with the provided data that you gave from your excel spreadsheet. When I created a new function in the Fitting Function Builder, I set a and b as parameters, T and R as constants. I input your equation in the function body. And I set an initial value for a = 6000, b = 5, I then set R = 8.3 and T = 303 (in the constant tab).

See figure below for fitted curve results:



If the provided description above does not help, where in the process is the error occurring for you? When click Quick check? When you try to use the function to fit a curve to your data? I noticed for me, that when I input large values for A and also input a small value for T, y = 0 (Yuki explanation below confirms this). But when I input a = 6000 and T = 303, this division makes the value small enough in the numerator to produce a y value that is not equal to zero.

Aviel Stern
OriginLab
Go to Top of Page

RibeiroS

Portugal
3 Posts

Posted - 05/03/2017 :  4:38:08 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Dear Aviel,

Thank you very much for all the work. I tried with the same initial values, same data but still when i do quick check y=0 and the fitting does not occur (screenshot bellow). Maybe im not defining something correctly. But please feel free to help. I think im giving you a hard time xD

Best!

Sara

Go to Top of Page

arstern

USA
237 Posts

Posted - 05/03/2017 :  4:55:23 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Sara,

I think I know why you are able to fit in excel and not in Origin. You are using two different equations in excel and Origin.

In your excel spreadsheet you use this equation:
exp(-a*(b-x)/(R*T))/(1+exp((-a*(b-x))/(R*T))), where R*T are both in the denominator. This is the equation that I used in Origin to make the fit.

According to your first post, you are using this equation in Origin:
(exp((-a * (b-x))/R*T))/(1+ exp((-a * (b-x))/R*T))
This describes R in the denominator, and T in the numerator.

Hope this helps,
Aviel
OriginLab
Go to Top of Page

RibeiroS

Portugal
3 Posts

Posted - 05/03/2017 :  7:09:44 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Dear Aviel,

You right! Indeed it was the expression! Thank you very very much!! And sorry for all the work!

Best!

sara
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