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 for Programming
 Forum for Origin C
 how to define a function in 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
cellbiophysics Posted - 03/08/2008 : 09:24:28 AM
Origin Version (Select Help-->About Origin): Origin 8
Operating System:Window XP

I'm trying to use kind of user-defined function in Origin C, called "func". I wrote a code like C-language but it didn't work. My code is as follows;

====================================================================
#include <origin.h>

double dSum = 0;
int ser=nser;

double func(int ni, double xi, double ti)
{
double fi;
fi = ni^2*xi+xi^3(ni+2*ti);
return fi;
}

for(int n = 0; n < ser; n++)
{
dSum += (-alp*bt)^n*((1-f)*func(n,x,t1)+f*func(n,x,t2));
}

y = A*dSum;
====================================================================

, where the fitting parameters are A, alp, bt, f, t1,and t2. nser is set to fixed value. But, there are some errors in compiling. The errors occurred at "double func(int ni...)". The error messages are as follows;

====================================================================
compiling...
_nlf3D_slow_080224.fit
FEEDBACK macros not defined
D:\OriginC\NLSF\_nlf3D_slow_080224.fit(42) :Error, invalid declaration
D:\OriginC\NLSF\_nlf3D_slow_080224.fit(42) :Error, general compile error
D:\OriginC\NLSF\_nlf3D_slow_080224.fit(30) :Error, error(s) found in compiling function _nlsf3D_slow_080224
====================================================================

Please let me know what's wrong. How can I fix it?
Thanks,

KB.

Edited by - cellbiophysics on 03/09/2008 9:04:59 PM
2   L A T E S T    R E P L I E S    (Newest First)
cellbiophysics Posted - 03/11/2008 : 03:25:05 AM
Dear Deanna,

Thanks!
Ooops! It's my mistake. :-)
it works!

KB
Deanna Posted - 03/11/2008 : 01:26:13 AM
Hi KB.

Please move your function outside the nlsf function, as in the screenshot below:



In addition, a "*" is missing after "xi^3" in your func.

Deanna
OriginLab Technical Services

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