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
 Fix intercept in polynomial 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
couturier Posted - 05/30/2020 : 3:19:36 PM
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
2   L A T E S T    R E P L I E S    (Newest First)
couturier Posted - 05/31/2020 : 5:57:11 PM
Thanks Castiel

Indeed, that line int nParam = (sLROptions.FixIntercept) ? nOrder : nOrder + 1; looked strange to me, but I didn't dare to change it
Castiel Posted - 05/31/2020 : 06:05:54 AM
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
**********************************************************

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