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