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