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 with a loop

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
mej Posted - 01/21/2004 : 12:15:28 PM
Hello

I want to fit 33 datasets with the same x values and i use this script

loop(n,1,33){
StartRange=0.5;
EndRange=0.9;
mks1=xindex(StartRange,data_a); // data_a is the x value
mks2=xindex(EndRange,data_a);
doc -uw;
lr data_int$(n); // data_int$(n) is the y values
};

But the result is not correct
2   L A T E S T    R E P L I E S    (Newest First)
mej Posted - 01/22/2004 : 11:07:35 AM
It is OK but the linear fit does not appear in the graphs previously ploted in each graph
Thanks
Mike Buess Posted - 01/21/2004 : 3:36:09 PM
1. mks1 and mks2 are usually reserved for use with the data selector tool. When using lr in a loop it's probably better to specify the range on the command line as shown below.
2. xindex uses a Y dataset as the argument, not the X dataset. Since the X values are shared by all Y datasets you only need to get the start and stop indices once.

StartRange=0.5;
EndRange=0.9;
i1=xindex(StartRange,data_int1);
i2=xindex(EndRange,data_int1);
loop (n,1,33) {
lr data_int$(n) -b i1 -e i2;
type $(n): $(lr.a), $(lr.b); // dataset #: intercept, slope
};

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 01/21/2004 6:32:53 PM

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