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

jester17

2 Posts

Posted - 06/14/2010 :  3:28:03 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 6.0
Operating System:Windows XP

Hello. I am trying to write labTALK code that will graph the data from my worksheet and then perform a polynomial fit. The graphing works fine, but the fitting doesn't seem to work. Here is my code:

wks.colSel(3,1);
wks.colSel(1,1);//selects the two columns I wish to graph, 1 on the x axis, 3 on the y axis.
work -p 201;//graphs selected columns on scatterplot
stat.data$=%H
stat.pr.order=2;
A=stat.pr.order;//debugging variable
type $(A);
stat.pr();
B=stat.pr.b1;//debugging variable
type $(B);

This is the first time I have ever used labVIEW, so I would just like simple suggestions on how to do the polynomial fit. The result should be that the data is graphed along with the standard red fitting line with the fitted equation displayed on the graph (the equivalent of selecting scatterplot, and then going to Analysis->Fit Polynomial.

Also, eventually I would like to import directly from excel into a worksheet. So any advice on that would be great.

Thanks

Laurie

USA
404 Posts

Posted - 06/23/2010 :  09:30:08 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

The "stat.data$=%H" line needs to be changed to the following:

stat.data$ = %C;

%H is a system string variable that returns the name of the active window whereas %C returns the name of the active dataset (which is what you want to fit)

The following link is an example script that will help:
http://www.originlab.com/www/support/resultstech.aspx?ID=185&language=English&Version=All

Also another tip is to hold down the Ctrl+Shift keys while selecting the Analysis:Fitting Polynomial menu. Instead of the analysis running, you'll see the following output to the Script Window:
run.section(PR,FitPolynomial)

You can then open the PR.ogs file in Notepad. The file will be in the Origin program folder. Look at the code in the [FitPolynomial] section.
This is the LabTalk code that runs when the menu is selected.


OriginLab Technical Support
Go to Top of Page

jester17

2 Posts

Posted - 06/28/2010 :  10:51:16 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks, that worked.

Now I'm trying to do this for a number of excel files. So, for example, I want to iterate through: file#.xls where # is some number and run my polynomial fit on all of the data on a specific sheet within those files. How would I do this?
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