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
 NE_QUAD_NO_CONV error on fitting

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
Surst Posted - 04/24/2013 : 05:23:49 AM
OriginPro 0.0.0G (32-bit)
Windows XP

Hi everyone, I'm having problems with fitting using an integral. My code is as following

#pragma numlittype(push, TRUE)
#pragma warning(error : 15618)
#include <origin.h>

#include <oc_nag8.h>

struct user   // parameters in the integrand
{
	double c, dE, p, E1, E;
 
};
// Function supplied by user, return the value of the integrand at a given x.
static double NAG_CALL f_callback(double x, Nag_User *comm) 
{
        struct user *sp = (struct user *)(comm->p);
 
        double dE, p, E1, E, b;
        p = sp->p;
        E1 = sp->E1;
        dE = sp->dE;
        E = sp->E;
 
	double EE = E-x-E1;
	double arg = EE*EE/(dE*dE*2.0)-p*ln(E-E1);
	return (arg < 30) ? exp(-arg) : 0.0;
}

double epsabs = 1E-12, epsrel = 0.00001;
epsrel = ebs;
 
Integer max_num_subint = 500;
 
double result, abserr;
 
Nag_QuadProgress qp;
 
static NagError fail;
 
        Nag_User comm;	
struct user s;
        //s.c = c;
        s.dE = dE;
        s.p = p;
        s.E1 = E1;
        s.E = x;
        comm.p = (Pointer)&s;
        
if (x > E1)
	d01smc(f_callback, Nag_Infinite, Nag_Infinite, epsabs, epsrel, max_num_subint, &result, &abserr, &qp, &comm, &fail);
else
	result = 0.0;
 
 if (fail.code != NE_NOERROR)
 {
         result = 0.0;
         printf("%s\n", fail.message);
 }
 
if (fail.code != NE_INT_ARG_LT && fail.code != NE_BAD_PARAM && fail.code != NE_ALLOC_FAIL)
{
	NAG_FREE(qp.sub_int_beg_pts);
	NAG_FREE(qp.sub_int_end_pts);
	NAG_FREE(qp.sub_int_result);
	NAG_FREE(qp.sub_int_error);
}
 
y = b + c*result;

When I simulate the function (manage fit functions, F9), the function looks quite good, but for some parameters it got "holes" in it. This means, the numerical integration fails with the error "NE_QUAD_NO_CONV: The integral is probably divergent or slowly convergent." I'm pretty sure that it's not divergent, so are there parameters, with which I can give the calculation more time or something like this?

Thanks for helping.
1   L A T E S T    R E P L I E S    (Newest First)
Penn Posted - 05/08/2013 : 10:08:47 AM
Hi,

You can change the max number of iterations, so to make the calculation more time. If you are using Origin 9, you can do it as following:

1. In NLFit dialog, select Settings tab, and then activate Advanced from the top-left panel.
2. In the top-right panel, find the tree node Fit Control: Iterations: Max. Number of Iterations, then change the number you want.

For more details, you can refer to this page.

Penn

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