Analysis: Signal Processing: Smooth
Performing smoothing of XY data to remove noise or irregularities
This feature is updated in 9.1 SR1. With the options of Lowess and Loess as smoothing method.
1. smooth //Perform default smoothing to active data plot or highlighted 1st column in worksheet. smooth %C also works so
2. smooth (1,2) //Perform default Savitzky-Golay filtering using default settings, to XY data in columns 1, 2 of the active worksheet
3. smooth iy:=Col(2) boundary:=periodic; //Perform default Savitzky-Golay filtering with Boundary Condition set to periodic, to Y data in 2nd column of active worksheet
4. smooth iy:=Col(2) polyorder:=3; //Perform Perform default Savitzky-Golay filtering with Polynomial Order set to 2, to Y data in 2nd column of active worksheet
5. smooth iy:=Col(2) method:=pf percent:=70; //Perform smoothing with Percentile Filtering method, percentile is set to 70, to Y data in 2nd column of active worksheet
6. smooth -t "my short noise removal theme.oth" //Perform smoothing to active plot or selected column using a pre-saved smoothing theme file you saved in the smoothing dialog
7. smooth -d //open smooth dialog
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 the input XY data range to be smoothed |
Method | method |
Input int |
|
Specifies the smoothing method to be used. The default is Savitzky-Golay. Option list:
|
Weighted Average | weight |
Input int |
|
This parameter is available only when Method is Adjacent-Averaging. When this parameter is set to 1 (checked), weighted averaging will be used. |
Specify Span by | prop |
Input int |
|
This variable is available only when Method is either Lowess or Loess.
Option list:
|
X Value | xval |
Input double |
|
When X Value is selected for Specify Span by, specifies the X Value. By default, this X Value is 0.1*(x max-x min). |
Span (0-1) | span |
Input double |
|
This is only available when Proportion is selected for Specify Span by (i.e. prop = 1). It specifies the proportion value for the span. The bigger the value is, the smoother the curve will be. |
Points of Window | npts |
Input int |
|
If FFT Filter is not selected for Method, this parameter specifies the number of points in the moving window. Otherwise, you can use this parameter to control the cutoff frequency for the FFT filter. The greater this value, the greater the degree of smoothing. It must be a non-zero positive value. See the Algorithm part for the computation of cutoff frequency. |
Boundary Condition | boundary |
Input int |
|
Specifies the boundary condition. It is not available when FFT Filter/Lowess/Loess is selected for Method. Option list
|
Polynomial Order | polyorder |
Input int |
|
This parameter applies only to the Savitzky-Golay smoothing option. It specifies the polynomial order. |
Percentile | percent |
Input double |
|
This parameter determines the percentile to be used in percentile filtering. The default is 50%, which corresponds to replacing the signal point with median value of the data points in the data window. |
Cutoff Frequency | cutoff |
Input double |
|
This parameter is visible in GUI when FFT Filter is selected for Method. It is a read-only variable showing the cutoff frequency of the low-pass filter calculated from Points of Window. Please do not use it in script. |
Pad to Power of 2 Points | pad |
Input int |
|
This parameter is available only when FFT Filter is selected for Method. It is available only from script. It specifies whether to pad the number of data points to power of 2. When this is set to 1, the result will match the result calculated with Origin prior to the Version 8. See more details in the Algorithm part. |
Filter Type | filter |
Input int |
|
This parameter is available only when FFT Filter is selected for Method. It is available only from script. It specifies the filter type. When old is selected, the result will match the result calculated with Origin prior to the Version 8. Option list:
|
Baseline to Subtract | baseline |
Input int |
|
This parameter is available only when FFT Filter is selected for Method. It is available only from script. It specifies whether to subtract a baseline before fft filtering is used. Option list:
|
Output | oy |
Output XYRange |
|
Specifies the destination of smoothed signal. See the syntax here. |
This example shows how import gaussian.dat into Origin.
Use white_noise X-Function to add white noise to it.
Use plotxy X-Function to plot the noised data
Smooth the data and then plot the the smoothed data in another new graph.
// Load data to a new book fname$ = system.path.program$ + "\Samples\Curve Fitting\Gaussian.dat"; newbook; impASC; string bkn$=%H; // add noise into the data white_noise [bkn$]1!(2) level:=10; // plot the noised data plotxy [bkn$]!(1,2) plot:=200 ogl:=[<new>]<new>; // smooth the noised data newsheet book:=bkn$ name:="Smoothed Data"; copydata [bkn$]1!(1) [bkn$]"Smoothed Data"!(1); smooth iy:=[bkn$]1!(2) oy:=[bkn$]"Smoothed Data"!(2) npts:=10; // plot the smoothed data plotxy [bkn$]"Smoothed Data"!(1,2) plot:=200 ogl:=[<new>]<new>;
For more information, please refer to our User Guide.
Keywords:adjacent averaging, savitzky golay, fft filter, lowess, loess, binomial, percentile