T O P I C R E V I E W |
Martta |
Posted - 04/09/2013 : 04:43:57 AM Hello all,
I'm working with Origin 8.6 and trying to finish my Master's thesis. I am trying to build equation with Origin C but I can't get it right. Here's the equation:
if ( x < Topt ) y=Iopt*exp*(-2,3*(x-Topt)^2/(Tinf-Topt)); else if ( x > Topt ) y=Iopt*exp*(-2,3*(x-Topt)^2/(Tsup-Topt));
When I go to Code Builder, I get the message "Compile error". This is what happens in the Code builder:
//---------------------------------------------------------- // void _nlsfLehmann( // Fit Parameter(s): double Iopt, double Topt, double Tsup, double Tinf, // Independent Variable(s): double x, // Dependent Variable(s): double& y) { // Beginning of editable part if ( x < Topt ) y=Iopt*exp*(-2,3*(x-Topt)^2/(Tinf-Topt)); else if ( x > Topt ) y=Iopt*exp*(-2,3*(x-Topt)^2/(Tsup-Topt)); // End of editable part }
I would really appreciate your help.
Thank you, Martta |
2 L A T E S T R E P L I E S (Newest First) |
Martta |
Posted - 04/09/2013 : 06:53:34 AM Thank you so very much, it's working now!
Best regards, Martta |
malgoska |
Posted - 04/09/2013 : 05:09:07 AM Hi, there are few issues with your function: 1. the if-else statements has syntax if(condition1) statement1; else statement2; so you don't need another if 2. use dots instead of commas as decimal mark 3. no need for asterisk after exponent.
Your function should look like this: // Beginning of editable part if ( x < Topt ) y=Iopt*exp(-2.3*(x-Topt)^2/(Tinf-Topt)); else y=Iopt*exp(-2.3*(x-Topt)^2/(Tsup-Topt)); // End of editable part
Regards, Margaret |
|
|