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
 Error compiling nag_zero_cont_func_bd_1 in fit

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
peptalasa Posted - 05/11/2010 : 5:57:11 PM
Origin Ver. and Service Release (Select Help-->About Origin): Origin Pro 8 v80724
Operating System: XP

Hi

I am trying to use the nag_zero_cont_func_bd_1 in a non linear fitting function. I am using according the manual, but I get this error message when I try to compile it:

Error, cannot convert argument in function call

Any hint is greatly appreciated. I have searched everywhere, but without success.

The code (not complete) is:

#include <stdio.h>
#include <OC_nag8.h>
#include <math.h>

static double fitE2(double,Nag_User *);

struct user {
double alpha;
double beta;
double DE;
double tE;
double s0;
double s1;
};


static double fitE2(double x,Nag_User *comm) {
double e0=8.85E-14;
double theta,r;
double e2;
double w;
double p=3.141516;
double alpha1,beta1,DE1,tHN1,s0,s1;

struct user *sp = (struct user *)(comm->p);

alpha1 = sp->alpha;
beta1 = sp->beta;
DE1= sp->DE;
tHN1=sp->tE;
s0=sp->s0;
s1=sp->s1;

w=2*pi*x;

r=( 1+(w*tHN1)^(1-alpha1)*sin(alpha1*p/2) )^2 + ((w*tHN1)^(1-alpha1)*cos(alpha1*p/2))^2;

theta=atan(((w*tHN1)^(1-alpha1)*cos(alpha1*p/2)) / ( 1+(w*tHN1)^(1-alpha1)*sin(alpha1*p/2) ) );

e2 = 1/(r^(beta1/2))*DE1*sin(beta1*theta);


return (e2+s1/(e0*w)-s0/(e0*w));
}


//----------------------------------------------------------
//
void _nlsfe2fit(
// Fit Parameter(s):
double alpha1, double beta1, double DE1, double tHN1, double sigma0, double sigma1,
double fC,
// Independent Variable(s):
double x,
// Dependent Variable(s):
double& y)
{
// Beginning of editable part
double e0=8.85E-14;
double theta,r;
double e2;
double w;
double p=3.141516;
double wC;

struct user *u;
double a, b,x1;
double ftol, xtol;
static NagError fail;
Nag_User comm;

a = 0.0;
b = 1.0;
xtol = 1e-05;
ftol = 0.0;
x1=x;
nag_zero_cont_func_bd_1(a,b,&x1,fitE2,xtol,ftol,&comm,&fail);


w=2*p*x;
wC=2*p*fC;

//Find the root

r=( 1+(w*tHN1)^(1-alpha1)*sin(alpha1*p/2) )^2+
((w*tHN1)^(1-alpha1)*cos(alpha1*p/2))^2;

theta=atan(((w*tHN1)^(1-alpha1)*cos(alpha1*p/2)) / ( 1+(w*tHN1)^(1-alpha1)*sin(alpha1*p/2) ) );

if(w<=fC) {
e2 = 1/(r^(beta1/2))*DE1*sin(beta1*theta)+(sigma1/(e0*w));
} else {
e2 = (sigma0/(e0*w));
}

y=e2;

1   L A T E S T    R E P L I E S    (Newest First)
Penn Posted - 05/11/2010 : 10:09:45 PM
Hi,

There is something wrong with the return type of the NAG callback function (fitE2) in your issue. It should be:

static double NAG_CALL fitE2(double,Nag_User *);

For more information about how to define NAG callback function, please refer to this page.

Penn

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