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 for Programming
 Forum for Origin C
 how to define a function in Origin C???
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

cellbiophysics

S. Korea
Posts

Posted - 03/08/2008 :  09:24:28 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

Deanna

China
Posts

Posted - 03/11/2008 :  01:26:13 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

cellbiophysics

S. Korea
Posts

Posted - 03/11/2008 :  03:25:05 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Dear Deanna,

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

KB
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