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
 linear fit YX1X2X3X4 data
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

OndrejMM

Australia
81 Posts

Posted - 06/15/2009 :  08:51:16 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi Guys,

I have data in the YXXXX format, and i would need to do linear fitting X1Y, X2Y, .... etc.,... I've decided to achieve this by modifying the XYYYY script,... very simple that i will always move X column to the first position, see the script below,... but it doesn't work!? I don't see what is wrong there,... I'm not getting any error message but it doesn't fit and it finishes after the first "ii",... many thanks in advance, Ondrej



newsheet name:=FitLines c:=1;// add new sheet to hold fit lines
range aa = 1!;//1st sheet, assume we start with just one data sheet
range bb = FitLines!;// the newly added sheet called "FitLines"
bb.ncols = aa.ncols;// Add new columns in FitLines sheet

loop(ii,2,aa.ncols) {
page.active=1;
colmove rng:=wcol(ii) operation:=0;
range dd = 1!(1,$(ii));
ftlr i:=dd o:=FitLines!(1, wcol(ii));
slopes[ii-1] = fitlr.b;//ii-1 because we loop from 2
intercepts[ii-1] = fitlr.a;
};

Deanna

China
Posts

Posted - 06/16/2009 :  01:12:59 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

It is not necessary to move the columns. You can just construct suitable ranges and then use these ranges when calling the X-Function.

For example, the loop can be rewritten as:

loop(ii,2,aa.ncols) {
range dd = 1!(wcol(ii), 1);
fitlr iy:=dd oy:=FitLines!(1, wcol(ii));
slopes[ii-1] = fitlr.b;//ii-1 because we loop from 2
intercepts[ii-1] = fitlr.a;
};


Deanna
OriginLab Technical Services
Go to Top of Page

OndrejMM

Australia
81 Posts

Posted - 06/16/2009 :  7:01:55 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
thank you Deanna,...
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