# 2.13.1.1 Average Multiple Curves

Multiple curves (XY data pairs) can be averaged to create a single curve, using the avecurves X-Function. This X-Function provides several options such as using the input X values for the output curve, or generating uniformly spaced X values for the output and then interpolating the input Y data before averaging.

The following example demonstrates averaging with linear interpolation:

string fpath$= "Samples\LabTalk Script Examples\LoadDSC.ogs"; string LoadPath$=system.path.program$+ fpath$;
if(!run.section(%(LoadPath$), Main, 0)) break 1; // Data should now be loaded now into the active workbook ... // Get the name of the active workbook, %H points to the active workbook string dscBook$=%H;
avecurves iy:=[dscBook$](1:end)!(1,2) rd:=[<input>]<new name:="Averaged Data">! method:=ave interp:=linear; Once averaged, the data and the result can be plotted: // plot all the data and the averaged curve, using the plotxy X-Function: plotxy [dscBook$](1:end)!(1,2) plot:=200;