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
 NLfit - building the function
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

dominik.mierzwa

Poland
116 Posts

Posted - 05/24/2023 :  08:14:12 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 2023b
Operating System: W10

Hi,
I have tried to build my own NLfit function but unsuccessfully. I have a function:
m=me+(m0-me)*exp(-k*t)

where
m=y
t=x
m0=max(y) - constant
me=min(y) - constant
k - parameter (initially 0.001)

The exemplary data are given below. Could you help me?
https://my.originlab.com/ftp/forum_and_kbase/Images/230524-example.opju

Kind regards,
Dominik

snowli

USA
1379 Posts

Posted - 05/24/2023 :  10:31:20 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

Since u want m0 and me to be max and min of y data, u will have to set them as parameter instead of constantso that u can use initial formula feature of Origin.
https://blog.originlab.com/use-initial-formula-to-better-guess-fitting-parameter-values-from-data

U can set them to be fixed so it's same as constant.

Here are key steps on each page when using Tools: Fitting Function Builder.

Function Type to be LabTalk Expression

independent variables: t
dependent variables: m
Parameters: m0,me,k

m0, me check "Fixed" checkboxes
Function Body: me+(m0-me)*exp(-k*t)

On next page, set as follows


Click Finish to finish the creation.

Now fit should work.

Thanks, Snow
Go to Top of Page

dominik.mierzwa

Poland
116 Posts

Posted - 05/25/2023 :  02:51:32 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by snowli

Hello,

Since u want m0 and me to be max and min of y data, u will have to set them as parameter instead of constantso that u can use initial formula feature of Origin.
https://blog.originlab.com/use-initial-formula-to-better-guess-fitting-parameter-values-from-data

U can set them to be fixed so it's same as constant.

Here are key steps on each page when using Tools: Fitting Function Builder.

Function Type to be LabTalk Expression

independent variables: t
dependent variables: m
Parameters: m0,me,k

m0, me check "Fixed" checkboxes
Function Body: me+(m0-me)*exp(-k*t)

On next page, set as follows


Click Finish to finish the creation.

Now fit should work.

Thanks, Snow



Hi,

It can't be so easy.... I have tried multiple options including script before and referencing to the col(B) but it does not work. Instead I should roll the manu and chose YMIN or YMAX...

Thank you very much, works perfectly!

Kind regards,
Dominik
Go to Top of Page

udhaya

India
2 Posts

Posted - 06/14/2023 :  05:17:40 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
i try to build the function of power law the equation a*[log(1/(2*3.14*f*t))]^-n +(b) with the parameters a=1,f=1,b=0,t=10^6 and n=1,2,3 it shows the values of the 0.85 nearer, in the other case with the same parameter olny the n varry to float(decimal) it not shows any out.

udhayakumars
Go to Top of Page

YimingChen

1593 Posts

Posted - 06/15/2023 :  09:23:11 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
This is because log(1/(2*3.14*f*t)) yields a negative value, and raising a negative value to the power of 0.1156 returns NaN (Not a Number).

James
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