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
 Origin Forum
 script for linear curve fitting with a twist...

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
Stephen Posted - 09/06/1998 : 3:51:00 PM
I am curreently working on a linear fit script with three columns of data. I am trying to plot column one verses column two, and then save the slope of the graph and the intercept of the graph. I will then graph column one minus the intercept of the first graph verses column three, and want to store the slope and intercept of the second graph. I then want to output the slope of the sirst graph, the slope of the second graph, and the square root of the second graph's intercept over the slope of the second graph.

If anyone can help me ( as I am a physicist, not a programmer), I will be most appreciative. Also, if anyone can help me get started, I would also be most appreciative.

4   L A T E S T    R E P L I E S    (Newest First)
Stephen Posted - 09/10/1998 : 2:49:00 PM
OK, hopefully this will be the last time I have to reply, because I know that I am being kinda bothersome, but I am still unsure about some of the dunctions about Microcal Labtalk. Here is the script I wrote with comments after every line to tell you exactle what I want this little script to do...

win -n plot

//create a graph window

layer.plotxy(Data1_A, Data1_B)

//plot column A of my dataset as X and column B of my dataset as Y

lr Data1

// Do a linear regression of the graph (ie a linear fit of the data points)

type "The Dark Current is " lr.b

// I want to output the slope of the first graph and tell that that is what the value of the dark current is

Data1_D = Data1_A - lr.a

// I want to make a new column in my dataset and sore the value in it of Column one minus the intercept of the first graph. Question? Would it be better if I just wrote over my original column A?

win -n plot

// Open a new graph window

layer.plotxy(Data1_D, Data1_C)

//plot column D of my dataset as X and column C of my dataset as Y

lr Data1

//Do a new linear regression of these points

type "The Responsivity is" lr.b;

// output that the responsivity of the data is the slope of the second graph

type "The noise is" sqrt(lr.a)/lr.b;

// Output that the noise of the date is the square root of the intercept of the second graph divided by the slope of the second graph.

That is it I suppose. I guess I am really more lost than ever, so any help would definately ake my day.


greg Posted - 09/09/1998 : 12:47:00 PM
In standard LabTalkTM notation a dataset is specified by WorksheetName_ColumnName so an example of using plotxy() is:

layer.plotxy(Data1_A, Data1_B)

which plots column B of worksheet Data1 (as Y) against column A of worksheet Data1 (as X). You could plot A against B with:

layer.plotxy(Data1_B, Data1_A)


Read the LabTalkTM Manual for syntax on all LabTalkTM commands, functions and objects.

greg Posted - 09/08/1998 : 12:39:00 PM
Until someone responds to your challenge, here are the key LabTalkTM commands and variables you would need to use:






win -n plot
Create a graph window
layer.plotxy(Xdataset, Ydataset)
Plots one dataset vs. another in a graph
lr DatasetName
Performs a linear regression on a dataset
lr.a
Variable that holds the linear regression intercept value
lr.b
Variable that holds the linear regression slope value

Also you should realize that LabTalkTM can perform math operations on datasets easily:

Data1_b = Data1_b - lr.a, for example, subtracts the value of the intercept of the last linear regression from Data1_b and puts the results back in Data1_b.

While your request doesn't require a great deal of LabTalkTM skill, non-programmers and busy professionals might wish to make use of our consulting services to create custom routines. Visit the Services Available area to get more details.


[This message has been edited by rtoomey (edited 08-10-99).]

[This message has been edited by rtoomey (edited 08-10-99).]

Stephen Posted - 09/08/1998 : 2:33:00 PM
What are you speaking of when you say xdataset and ydataset?

Thanks,
Stephen


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