Analysis : Mathematics : Average Multiple Curves
Average or concatenate multiple curves
1. avecurves iy:=(Plot(1),Plot(2)) method:=concatenate; 2. avecurves iy:=((1,2),(3,4)) method:=ave avex:=common interp:=linear;
Please refer to the page for additional option switches when accessing the x-function from script
Display Name |
Variable Name |
I/O and Type |
Default Value |
Description |
---|---|---|---|---|
Input | iy |
Input XYRange |
|
Specifies multiple curves to be averaged or concatenated. Note that beginning with Origin 2020b, there is a shortened syntax that follows the form [Book]Sheet!(X,Y1:YN), X = the common X column and Y1:YN = a contiguous range of Y columns to the right of the X column. More complex strings from non-contiguous data of the form [Book]Sheet!((X,Y1:YN),(X,YM:YO)) are also possible. |
Method | method |
Input int |
|
Specifies the method.
Option list:
|
Averaged X | avex |
Input int |
|
This is available only when Average is selected for the Method. It specifies the method to compute the X values of the averaged curve.
Option list:
|
Tolerance for Common X Values | toler |
Input double |
|
This is available only when Same as Source X is selected for Averaged X. It is used to check if the X values of input curves are the same. Two, different X values are considered the same if abs(X1 - X2) < |
Number of Points | npts |
Input int |
|
This is available when Averaged X is not set to Same as Source X. It specifies the number of evenly spaced X points from X Minimum to X Maximum to get Y values based on the chosen Interpolate method. If Averaged X is Custom you can uncheck the Auto checkbox and specify the minimum or maximum values. |
X Minimum | xmin |
Input double |
|
This is editable only when Custom is selected for Averaged X. It is read-only for Common X Range and Full X Range. It specifies the minimum X value of the averaged curve. It computes a number automatically if the Auto checkbox is enabled. You can also disable the Auto checkbox and specify the values. |
X Maximum | xmax |
Input double |
|
This is editable only when Custom is selected for Averaged X. It is read-only for Common X Range and Full X Range. It specifies the maximum X value of the averaged curve. It computes a number automatically if the Auto checkbox is enabled. You can also disable the Auto checkbox and specify the values. |
Interpolate | interp |
Input int |
|
This is available only when Averaged X is not set to Same as Source X. It specifies a method to interpolate the Y values when averaging.
Option list:
|
No Extrapolation | extrap |
Input int |
|
This is available only when Averaged X is not set to Full X Range, Custom, and Follow Curve Trace. It is used to specify whether to extrapolate the curves when these curves have different X ranges. |
Sort X | sortx |
Input int |
|
This is available only when Concatenate is selected for Method. It specifies the method to sort the X values of the averaged curve. Y values will be reordered accordingly.
Option list:
|
Std Dev | sd |
Input int |
|
This variable is available only when the Method variable is set to Average. It specifies whether or not to compute the standard deviations of the averaged curve. |
Std Err | se |
Input int |
|
This variable is available only when the Method variable is set to Average. It specifies whether or not to compute the standard errors of the averaged curve. |
N | n |
Input int |
|
This variable is available only when the Method variable is set to Average. It specifies whether or not to compute the counts of input data points that correspond to each averaged X value. |
Minimum | min |
Input int |
|
This variable is available only when the Method variable is set to Average. It specifies whether or not to output the minimum value. |
Maximum | max |
Input int |
|
This variable is available only when the Method variable is set to Average. It specifies whether or not to output the maximum value. |
SD times 2 | sd2 |
Input int |
|
This variable is available only when the Method variable is set to Average. It specifies whether or not to compute the standard deviation times 2. |
SD times 3 | sd3 |
Input int |
|
This variable is available only when the Method variable is set to Average. It specifies whether or not to compute the standard deviation times 3. |
Output | rd |
Output ReportData |
|
Specifies the output data. |
avecurves iy:=(plot(1), plot(2)) method:=concatenate;
/* This example shows how to average multiple XY data that are monotonic in X but do not necessarily share X values. The sample data used is in OriginPath\Samples\Spectroscopy\DSC\Data folder 1. Load the data to different worksheets of the same book 2. use avecurves XF to average the A(X)B(Y) of all the sheets. 3. put the result into a new sheet 4. Plot the original into one graph and the averaged data into another graph */ // Load the sample data to separated sheets, using existing // loadDSC.ogs string LoadDSCogsPath$=system.path.program$ + "Samples\LabTalk Script Examples\LoadDSC.ogs"; %A=LoadDSCogsPath$; if(!run.section(%A, Main, 0)) break 1; // Data should be loaded now into active book string dscBook$=%H; // plot all the data A(X), B(Y) first plotxy [dscBook$](1:end)!(1,2) plot:=200; // Perform average on all the sheets data using interp average method with linear interpolation avecurves iy:=[dscBook$](1:end)!(1,2) rd:=[<input>]<new name:="Averaged Data">! method:=ave interp:=linear; // plot the averaged as well plotxy [dscBook$]"Averaged Data"!(1,2) plot:=200 ogl:=[<new>]<new>!;
Please refer to this page in the User Guide for more information: