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
 LabTalk Forum
 Get coefficients in polynom fitting
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

JokerOne

Germany
58 Posts

Posted - 02/18/2016 :  09:55:54 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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





  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