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
 Fitting by different functions
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

AnnaOrlova

Russia
2 Posts

Posted - 08/04/2011 :  5:27:15 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. 7.5 and Service Release (Select Help-->About Origin):7.5763
Operating System: Windows 7

Hello!
Could anybody help me..
How I can fit my data simultaneously by different fit-functions with the same parameters?
I have col(A)- X and col(B) - Y and I have 3 different functions with the same parameters : A,B,W for example
Y1 = A (1-B*(1.2exp(-20Wx)+0.8exp(-30Wx)))
Y2 = A (1-B*(1.7exp(-15Wx)+0.3exp(-Wx)))
Y3 = A (1-B*(0.2exp(-2Wx)+1.8exp(-3Wx)))
I want fit my data with these functions simultaneously and get parameters A,B,W for every case (Y1,Y2,Y3).

Hideo Fujii

USA
1582 Posts

Posted - 08/05/2011 :  10:26:56 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Anna,

If the same function can be applied to multiple datasets, you can, of course, use the "Global Fit" with parameter sharing (don't remember if Origin7.5 has this, but at least 8.x has). If for different functions like in your case, there is no straightforward way; but, here is one possible way I have come up to:

1) Merge the data of your all three XY columns pairs into a single pair of XY columns.
2) Add an extra column, say ID to this new worksheet, and fill it with the id numbers of the
  function, {1, 2, 3} to determine the function.
3) Define a user-defined function in LabTalk form (Y-Script) such that:
  if(ID==1)      Y=A*(1-B*(1.2*exp(-20*W*x)+0.8*exp(-30*W*x))); 
  else if(ID==2) Y=A*(1-B*(1.7*exp(-15*W*x)+0.3*exp(-W*x)));
  else if(ID==3) Y=A*(1-B*(0.2*exp(-2*W*x)+1.8*exp(-3*W*x)));
  such as Y as dependent, X and ID as independent variables.
4) Fit the data in this {X, ID, Y} worksheet with this multi-independent function.

Maybe people can suggest better idea...

--Hideo Fujii
OriginLab
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 08/05/2011 :  2:22:06 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

I think I have found a better way in your case because three functions have the same "form", though different. You can define the user-defined functions with extra four parameters, say P1,P2,P3, and P4 in addition to A, B, and W such that:

Y=A*(1-B*(P1*exp(P2*W*x)+P3*exp(P4*W*x));

Then, you can perform the "global fit" with shared parameters of A, B, and W; but P1-P4 are not shared, and you can FIX them for each dataset such that:

P1_1=1.2; P2_1=-20; P3_1=0.8; P4_1=-1;
P1_2=1.7; P2_2=-15; P3_2=0.3; P4_2=-30;
P1_3=0.2; P2_3= -2; P3_3=1.8; P4_3=-3;

So, in this way, you don't have to merge datasets into a single XY, nor to make an extra ID variable.
Furthermore, however, this method cannot be applied when function forms are different each other, though my first method can.

Hope this helps!

--Hideo Fujii
OriginLab

Edited by - Hideo Fujii on 08/05/2011 2:32:51 PM
Go to Top of Page

AnnaOrlova

Russia
2 Posts

Posted - 08/05/2011 :  4:19:56 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hideo!
Thank you a lot!!!
I try doing the second way that you advice and will write about results!

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