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
 Failed to build equation with Origin C

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

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