T O P I C R E V I E W |
Clairekun |
Posted - 05/12/2014 : 10:34:17 AM Origin Ver. and Service Release (Select Help-->About Origin): 9 Operating System: Win7
Hello,
I have failed to find a similar topic, please forgive me if I skipped it somehow.
I have a plotted dataset that could be fitted to a linear regression function. My code includes both importing and plotting of this data.
My X data reaches a maximum and then goes back. I would need a code to linearly fit my data up to that maximum.
I know little about programming so please don't cry in desperation when you read what I tried . I have tried to combine plotting and fitting with plotxy and fitLR iy, setting the number of points to fit with N. I did it by defining dd=max(col(A)) before the plotting bit, and N=dd. This obviously didn't work, but I am clueless as to how to achieve this.
Thank you. |
8 L A T E S T R E P L I E S (Newest First) |
Clairekun |
Posted - 05/20/2014 : 6:40:46 PM I believe I could run a script to open my batch template and then import my data, so that part would not be a problem.
Anyway, the problems I have found are now different from the initial topic, so I'll start a new one that shows my question more clearly.
Thanks again.
|
lkb0221 |
Posted - 05/20/2014 : 5:21:04 PM Hi,
If using script button, then there is no way to batch processing. How about using worksheet script (Worksheet: Worksheet Script), run after import. And let the graph be a single sheet (add graph as sheet). In this way you can still use this template to batch processing. But this will require more coding works.
Zheng OriginLab |
Clairekun |
Posted - 05/20/2014 : 3:10:54 PM Hi,
I'm trying to generate an analysis template and it works very nicely. However, I would like to be able to have the fitted plot and fitting summary in a separate window, too (having the summary embedded to the graph, just as if I had fitted the data directly from the plot).
How could I do this? Since I am going to use it very often, I plan to add a script button. Therefore, I'd appreciate it if there was labtalk script I could use for this.
Thank you. |
lkb0221 |
Posted - 05/14/2014 : 2:49:01 PM Hi,
You should do the analysis before plotting. I suggest you making a analysis template for batch processing, and it should be able to do all your fitting and graphing works.
Zheng OriginLab |
Clairekun |
Posted - 05/14/2014 : 12:21:42 PM Since I am obtaining those graphs by importing and plottng data. Is there any way to include the fitting part so that I don't have to work with every plot individually?
Thanks!
quote: Originally posted by lkb0221
Hi,
Then specify the book name and sheet name in the range declare. For example: range rr = [Book1]sheet1!col(A)
And let it be the input for XFs. For example: ... iy:=rr ... or max(rr)
Zheng OriginLab
|
lkb0221 |
Posted - 05/14/2014 : 09:53:10 AM Hi,
Then specify the book name and sheet name in the range declare. For example: range rr = [Book1]sheet1!col(A)
And let it be the input for XFs. For example: ... iy:=rr ... or max(rr)
Zheng OriginLab
|
Clairekun |
Posted - 05/13/2014 : 04:45:57 AM The error that I get is the same as I did before:
Invalid column name: COL(A) Unknown, VarName = iy, VarValue =
This is because the graph is already created, so there is no actual column A in the graph.
I tried adding the definition of ii before the plotting code bit, where I still got the last error. Using the whole code before plotting does nothing. |
lkb0221 |
Posted - 05/12/2014 : 3:40:48 PM Hi,
You want to fit the first half of your data (min -> max) or the second half (max -> min)? Or the whole dataset? Anyway, you might need to use a sub-range as input of fitLR X-function. Something like below:
ii = list(max(col(A)),col(A)); // Return the index # of where the max X first appear range rr = col(A)[1:$(ii)]; // Define a sub-range fitLR iy:=rr;
Or, use the N in fitLR XF. Notice that this variable specifies the number of points to use in the linear regression. When this value is zero, all points in the range are used. When the number is a positive integer, the first N points are used. When the number is a negative integer, the last N points are used.
ii = list(max(col(A)),col(A)); fitLR iy:=col(A) N:=ii;
Hope this would help.
Zheng OriginLab |