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
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 linear fit YX1X2X3X4 data

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
OndrejMM Posted - 06/15/2009 : 08:51:16 AM
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;
};
2   L A T E S T    R E P L I E S    (Newest First)
OndrejMM Posted - 06/16/2009 : 7:01:55 PM
thank you Deanna,...
Deanna Posted - 06/16/2009 : 01:12:59 AM
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

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000