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
 All Forums
 Origin Forum
 Origin Forum
 Curve fitting with intermediate variables

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
sevny Posted - 02/22/2013 : 12:13:35 PM
Origin Ver. and Service Release (Select Help-->About Origin): 8.0
Operating System:Win

Hello, I got another question about nonlinear curve fitting.
I am trying to do curve fitting with a set of equations with intermediate variables. Different from the problem before, these equations can be combined and expressed as one equation of y=f(x) form,however, the one equation will be super-complex to write down. Therefore I introduced several intermediates and seperated the equation into several equations (as follows).So in principle, the fitting and simulation should be straightforward. The problem is, when I tried to simulate the curve with a set of parameters, I got no curve appeared on the coordinates. And compiling was no problem. I am not sure if it is because the equations are still too complex for the computer to handle, as when I testing with simpler equations but similar format, it worked well. Please help me check the equations, if it is the reason, how can I solve the problem? Thank you very much for any comment.

void _nlsfTwosite_with_n(
// Fit Parameter(s):
double Vi, double V0, double R0, double M0, double L0, double fi, double K1, double K2,
double H1, double H2, double n1, double n2,
// Independent Variable(s):
double x,
// Dependent Variable(s):
double& y)
{
// Beginning of editable part
double ft1,ft2,p1,q1,r1,p2,q2,r2,L1,L2,x11,x12,x21,x22;
ft1=R0/(R0+x);
ft2=ft1/fi;
p1=1/K1+1/K2+(n1+n2)*M0*ft1-L0*(1-ft1);
q1=(n1/K2+n2/K1)*M0*ft1-(1/K1+1/K2)*L0*(1-ft1)+1/(K1*K2);
r1=-L0*(1-ft1)/(K1*K2);
p2=1/K1+1/K2+(n1+n2)*M0*ft2-L0*(1-ft2);
q2=(n1/K2+n2/K1)*M0*ft2-(1/K1+1/K2)*L0*(1-ft2)+1/(K1*K2);
r2=-L0*(1-ft2)/(K1*K2);
L1=-p1/3-2^(1/3)*(-p1^2+3*q1)/(3*(-2*p1^3+9*p1*q1-27*r1+3*3^0.5*(-(p1*q1)^2+4*q1^3+4*p1^3*r1-18*p1*q1*r1+27*r1^2)^0.5)^(1/3))+(-2*p1^3+9*p1*q1-27*r1+3*3^0.5*(-(p1*q1)^2+4*q1^3+4*p1^3*r1-18*p1*q1*r1+27*r1^2)^0.5)^(1/3)/(3*2^(1/3));
L2=-p2/3-2^(1/3)*(-p2^2+3*q2)/(3*(-2*p2^3+9*p2*q2-27*r2+3*3^0.5*(-(p2*q2)^2+4*q2^3+4*p2^3*r2-18*p2*q2*r2+27*r2^2)^0.5)^(1/3))+(-2*p2^3+9*p2*q2-27*r2+3*3^0.5*(-(p2*q2)^2+4*q2^3+4*p2^3*r1-18*p2*q2*r2+27*r2^2)^0.5)^(1/3)/(3*2^(1/3));
x11=K1*L1/(1+K1*L1);
x12=K1*L2/(1+K1*L2);
x21=K2*L1/(1+K2*L1);
x22=K2*L2/(1+K2*L2);
y=M0*V0*ft1*(n1*(x11-x12)*H1+n2*(x21-x22)*H2)/(Vi*L0);
// End of editable part
}
2   L A T E S T    R E P L I E S    (Newest First)
sevny Posted - 02/25/2013 : 10:35:53 AM
Thanks a lot for your reply Shirley. I tried to use different values for the parameters, like Vi=6E-6, V0=0.00143, R0=20, M0=1E-5, L0=2E-4, fi=0.995813, K1=1E7, K2=1E14, H1=-10, H2=2, n1=0.5, n2=0.5, which were from the experiments (or close estimations), but still no curve; while reseasonable result was obtained when using Mathematica to solve a series of such equations with these parameter values.

Shirley_GZ Posted - 02/25/2013 : 03:02:43 AM
Hi,

When the parameter Vi=1, V0=1, R0=1, M0=1, L0=1, fi=1, K1=1, K2=1, H1=1, H2=1, n1=1, n2=1, and X equals a value (such as 2 or 1.5), the parts of the equations (L1 and L2),
"-(p1*q1)^2+4*q1^3+4*p1^3*r1-18*p1*q1*r1+27*r1^2"
and
"-(p2*q2)^2+4*q2^3+4*p2^3*r2-18*p2*q2*r2+27*r2^2"
are negative. So the intermediate variables L1 and L2 are missing values.

So you got no curve appeared when you tried to simulate the curve.

Originlab Technical Service Team

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000