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
 Regarding NLFIT of functions with multi-variables
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

izilakos

Greece
3 Posts

Posted - 03/28/2012 :  1:14:11 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I would like to pose a problem that has been puzzling me many days now and ask for an advice from this forum, concerning non linear global fitting of functions with more than one independent & dependent variables that share parameters. Let me pose a simple example :
Let us consider two data sets (xdata1,ydata1) & (xdata2,ydata2) and two functions:
y1=A1*x1^2 + A2*x2 + b1
y2=A1*x1^3 + A2*cosx2 + c1
, where y1,y2 are the dependent variables, x1,x2 the independent variables , A1,A2 the shared parameters and b1,c1 parameters with fixed values or parameters to be fitted.
The problem is to simultaneously fit the first function to the first data set and the second function to the second one. Note that A1,A2 have to be fitted simultaneously to both functions.
The solution I have came up with (still I am not sure if its the best way to do it) is the following:
I have created a new user defined function by using Origin C option and the formula of the function I have used is the following :
Y=par1*(A1*x1^2 + A2*x2 + b1)+par2*(A1*x1^3 + A2*cosx2 + c1)
where par1 and par2 are parameters with a fixed value (i.e 1 or 0).
In the data selection option I imported the two data sets and applied the global fitting option.
In the parameter tab I defined the A1 & A2 parameters as shared parameters and regarding the par1_1, par1_2,par_1 and par2_2 I did the following :
since par1_1 and par2_1 refer to the first data set I have fixed their value to 1 and 0 respectively activating only the first part of the function (i.e A1*x1^2 + A2*x2 + b1).
Similarly since par1_2 and par2_2 refer to the second data set I have fixed their value to 0 and 1 respectively activating only the second part of the function (i.e. A1*x1^3 + A2*cosx2 + c1).
After all these my question to the members of the forum is :
"is there a better/quicker/easier way to cope with this problem???"

Hideo Fujii

USA
1582 Posts

Posted - 03/29/2012 :  4:49:51 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Origin's NLFit allows the fitting function to have both two independent variables AND two-dependent variables. By that way, you don't have to do something more complicated??

Like in this way:
http://wiki.originlab.com/~originla/howto/index.php?title=Tutorial:Nonlinear_Multiple_Variables_Fitting

--Hideo Fujii
OriginLab

Edited by - Hideo Fujii on 03/29/2012 4:55:19 PM
Go to Top of Page

izilakos

Greece
3 Posts

Posted - 04/02/2012 :  04:47:31 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Dear Hideo Fujii,
Firstly I would like to thank you for your swift reply. The solution that you proposed seems to work better than the global fitting (and I think more accurate) but I can't find a way to treat the fitting procedure with data sets that have different number of values.
For the above mentioned example if the first data set has 10 pairs of {xdata1,ydata1} and the second data set has 20 pairs of {xdata2,ydata2} then the fitting procedure will take into account the values of data set 2 until [xdata2_10,ydata2_10]. So is it possible to fit data sets with different "length"?
Go to Top of Page

easwar

USA
1964 Posts

Posted - 04/02/2012 :  5:01:21 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by izilakos

Dear Hideo Fujii,
The solution that you proposed seems to work better than the global fitting (and I think more accurate) but I can't find a way to treat the fitting procedure with data sets that have different number of values.



Hi,

You are correct, the first ten points from the two datasets are used and the other 10 in the 2nd dataset are ignored, and this is because the parameters are the same in both functions.

Try doing the following:

Define your function as:

y1=A11*x1^2 + A12*x2 + b1
y2=A21*x1^3 + A22*cos(x2) + c1


Then turn on Constraints, and supply the linear constraints:

A11=A21;
A12=A22;

Remember to enable linear constraints in your function.

Does this work?

Easwar
OriginLab
Go to Top of Page

izilakos

Greece
3 Posts

Posted - 04/04/2012 :  04:49:35 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Dear Easwar,

thank you for your advice. Although I followed the procedure you suggested, I did not succeed on achieving convergence for my actual fitting model.
However I used the interpolation/extrapolation tool of the mathematics toolbox so as to achieve the same number of data points for all my data sets and it seems that it's working fine.
I would like to thank you both for your time and your well-aimed remarks.
I would also like to inform the users (new and old) of this forum that these posts regarding non-linear fitting, concern problems I confronted on the fitting procedure of a strain energy function to experimental data of a hyperelastic material. I hope that my remarks and your replies would also be as useful to other persons working on this, as it were for me.
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