JokerOne
Germany
58 Posts |
Posted - 02/18/2016 : 09:55:54 AM
|
Origin Ver. 9 and Service Release 1(Select Help-->About Origin): Operating System: Win 7
I am trying to fit some data using polynoms with varying order. In the documentation I found two option in doing so using LabTalk:
1.) polyfit X-function: http://www.originlab.com/doc/LabTalk/guide/Linear-Fitting#Polynomial_Regression
This was perfect, if not the fact, that I like to investigate the sum of the squared residuals. If am am correctly, this value is not provided in the output of polyfit. However, the polynom coeffients are sorted nicely in a dataset.
2.) Using xop and the FitPolynomial class as described here: http://www.originlab.com/doc/LabTalk/examples/Curve-Fitting#Polynomial_Fit
This looks very nice, as one has access to basically every result value you can think of, BUT, here, the coefficients are sorted seperately in the result tree structure. As also given in the example one has to "pick" every coefficient, like:
// Get the coefficients from the output tree coef1[1] = polyOut.Parameters.Intercept.Value; coef1[2] = polyOut.Parameters.B1.Value; coef1[3] = polyOut.Parameters.B2.Value; coef1[4] = polyOut.Parameters.B3.Value;
I would prefer to use option 2, however, when I want to use varying polynom orders, I guess, that I somehow have to cope with this mentioned issue. Is there an easy way, like a magical function: GetCoeff(result_tree) ? Otherwise, I guess I will have to write a huge Switch-structure, switching through all possible orders or so...?
Thanks for your help
|
|