OriginLab Corporation - Scientific Graphing and Data Analysis Software - 2D graphs, 3D graphs, Contour Plots, Statistical Charts, Data Exploration, Statistics, Curve Fitting, Signal Processing, and Peak Analysis

averagexy

Contents

Brief Information

Average or concatenate multiple curves


Command Line Usage

  1. averagexy iy:=(Plot(1), Plot(2)) method:=concatenate x:=myX y:=myY;
  2. averagexy iy:=((1,2),(3, 4)) method:=ave avex:=common interp:=linear x:=5 y:=6;

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Input iy

Input

XYRange

<active>
Specifies multiple curves to be averaged or concatenated.
Method method

Input

int

0
Average Method

Option list:

  • ave:Average
    Average the input curves by consolidating the same X values and averaging their corresponding Y values.
  • concatenate:Concatenate
    Concatenates the input curves.
Averaged X avex

Input

int

2
It is available only when Ave is selected for Method. It can specify the method to compute the X values of the averaged curve.

Option list:

  • same:Same as Source X
    Use the X values of all input curves as the averaged curve's X. X values within tolerance specified by toler will be treated as the same x and averaged.
  • common:Common X Range
    Compute the X values of the averaged curve in the common X range of the input curves. It uses an interpolation method which is specified by interp to interpolate on the curves to make them have the same X values and then average the curves.
  • full:Full X Range
    Compute the X values of the averaged curve in the full X range of the input curves. It uses an interpolation method which is specified by interp to interpolate on the curves to make them have the same X values and then average the curves.
  • custom:Custom
    Compute the X values of the averaged curve in the X range which you have customized in xmin and xmax. It uses an interpolation method which is specified by interp to interpolate on the curves to make them have the same X values and then average the curves.
  • trace:Follow Curve Trace
    Compute the X values of the averaged curve by trace interpolation, which can create a new curve with the similar shape of the input curves. For more details, please refer to Algorithm below.
Tolerance for Common X Values toler

Input

double

1e-8
It is available only when ave is selected for method and same is selected for avex. It is used to check if the X values of input curves are the same.
Number of Points npts

Input

int

<auto>
It is available when ave is selected for method and aveX is not set to same. It specifies the number of points of the interpolated curves. In the dialog box, it computes a number automatically if the nearby Auto checkbox is enabled. You can also disable the Auto checkbox and specify the values by yourself.
X Minimum xmin

Input

double

<auto>
It is editable only when custom is selected for avex. It specifies the minimum X value of the averaged curve. In the dialog box, it computes a number automatically if the nearby Auto checkbox is enabled. You can also disable the Auto checkbox and specify the values by yourself. This variable is read-only if Common X Range or Full X Range is selected for Averaged X.
X Maximum xmax

Input

double

<auto>
It is editable only when custom is selected for avex. It specifies the maximum X value of the averaged curve. In the dialog box, it computes a number automatically if the nearby Auto checkbox is enabled. You can also disable the Auto checkbox and specify the values by yourself. This varialbe is read-only if Common X Range or Full X Range is selected for Averaged X.
Interpolate interp

Input

int

0
It is available only when avex is not set to same. It specifies the method to interpolate the X values before averaging the input curves.

Option list:

Sort X sortx

Input

int

1
It 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:

  • none:None
    Do not sort the X values.
  • ascend: Ascending
    Sort the X values ascendingly.
  • descend: Descending
    Sort the X values descendingly
X x

Output

vector

<optional>
Specifies the column for output averaged X values.
Y y

Output

vector

<optional>
Specifies the column for output averaged Y values.
Std Dev sd

Output

vector

<optional>
This variable is available only when method is set to ave. It specifies whether or not to compute the standard deviations of the averaged curve.
Std Err se

Output

vector

<optional>
This variable is available only when method is set to ave. It specifies whether or not to compute the standard errors of the averaged curve.
N n

Output

vector

<optional>
This variable is available only when the method is set to ave. It specifies whether or not to compute the counts of input data points that correspond to each averaged X value.

Description

This function calculates the average of the input curves or concatenates them, and then output the X, Y value as vectors, respectively.

If the Method variable is set to Concatenate, the input ranges will be joined to form a larger data set. Otherwise, the averaged Y values for the input curves will be computed.

The interpolation is performed on all the input curves' x values to form an uniform X range for the averaged curve. Or, you can simply join the x values of all the input curves to form a larger data set. In this case, you can specify a tolerance and the minor differences in x values are ignored.

If x values of input curves are not monotonic, the curves are sorted first and then Origin averages these monotonic curves. For average computation, the standard deviations, standard errors and number of points that correspond to each X value can be also outputted.

Examples

The following script command is used to average two curves data in the active worksheet using linear interpolation on the X values.

averagexy iy:=((col(1),col(2)),(col(3), col(4))) method:=ave avex:=common x:=<new> y:= <new>;

Then two columns are added to the input worksheet. One stores the x values and other stores the y values of the averaged curve.

Algorithm

When the Method variable is set to Concatenate, all the input ranges are simply joined together. Otherwise, average Y values are computed for the input curves. For computing the X values of the averaged curve, this X-Function provides five methods.

For more information about the method of computing the x values, please refer to the algorithm of avecurves.

Related X-Functions

avecurves