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
 Fix intercept in polynomial fit
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

couturier

France
291 Posts

Posted - 05/30/2020 :  3:19:36 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 2020b
Operating System:win10

Hi,
I'd like to fit with 2nd order polynom and fix intercept (i.e equation is y = a*x^2 + b*x).

I tried the example given with function ocmath_polynomial_fit

However when I try to fix intercept:
sLROptions.FixIntercept = true;
sLROptions.FixInterceptAt = 0;
the function won't work

How can I do that ?
Thanks

Castiel

343 Posts

Posted - 05/31/2020 :  06:05:54 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by couturier

Origin Ver. and Service Release (Select Help-->About Origin): 2020b
Operating System:win10

Hi,
I'd like to fit with 2nd order polynom and fix intercept (i.e equation is y = a*x^2 + b*x).

I tried the example given with function ocmath_polynomial_fit

However when I try to fix intercept:
sLROptions.FixIntercept = true;
sLROptions.FixInterceptAt = 0;
the function won't work

How can I do that ?
Thanks



That example is incorrect. Be the sLROptions.FixIntercept true or false, the size of psFitParameter must be at least (nOrder+1). To fix the problem:
//int nParam = (sLROptions.FixIntercept) ? nOrder : nOrder + 1;
int nParam = nOrder + 1;


You can also check the returned value from ocmath_polynomial_fit. nRet = -98 means STATS_PARAMS_ARRAY_TOO_SMALL.


                                          &&&&&&&&&
                                        &&&
                                       &&
                                      &  _____ ___________
                                     II__|[] | |   I I   |
                                    |        |_|_  I I  _|
                                   < OO----OOO   OO---OO
**********************************************************
Go to Top of Page

couturier

France
291 Posts

Posted - 05/31/2020 :  5:57:11 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks Castiel

Indeed, that line int nParam = (sLROptions.FixIntercept) ? nOrder : nOrder + 1; looked strange to me, but I didn't dare to change it
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