Smooth Data
Smooth noisy data in the Live Editor
Description
TheSmooth Datatask lets you interactively smooth noisy data. The task automatically generates MATLAB®code for your live script.
Using this task, you can:
Customize the method for smoothing data in a workspace variable.
Adjust parameters to generate less or more smoothing.
Automatically visualize the smoothed data.
Open the Task
To add theSmooth Datatask to a live script in the MATLAB Live Editor:
On theLive Editortab, click任务and select theSmooth Dataicon.
In a code block in the live script, type a relevant keyword, such as
smooth
ornoisy
. SelectSmooth Datafrom the suggested command completions.
Examples
Parameters
Input data
— Valid input data from workspace
vector | table | timetable
This task operates on input data contained in a vector, table or timetable. The data can be of typesingle
,double
,logical
, or signed or unsigned integer types such asint64
.
When providing a table or timetable for the input data, specifyAll supported variablesto operate on all variables with a supported type. ChooseAll numeric variablesto operate on all variables of typesingle
ordouble
, or signed or unsigned integer types. To choose specific supported variables to operate on, selectSpecified variablesand then select the variables individually.
Smoothing method
— Method for smoothing data
Moving mean
(default) |Moving median
|Gaussian filter
| ...
Specify the smoothing method as one of these options, which operate over local windows of data.
Method | Description |
---|---|
Moving mean |
Moving average. This method is useful for reducing periodic trends in data. |
Moving median |
Moving median. This method is useful for reducing periodic trends in data when outliers are present. |
Gaussian filter |
Gaussian-weighted moving average. |
Local linear regression |
Linear regression. This method can be computationally expensive, but it results in fewer discontinuities. |
Local quadratic regression |
Quadratic regression. This method is slightly more computationally expensive than local linear regression. |
Robust local linear regression |
Robust linear regression. This method is a more computationally expensive version of local linear regression, but it is more robust to outliers. |
Robust local quadratic regression |
Robust quadratic regression. This method is a more computationally expensive version of local quadratic regression, but it is more robust to outliers. |
Savitzky-Golay polynomial filter |
Savitzky-Golay polynomial filter, which smooths according to a polynomial of specified degree, and is fitted over each window. This method can be more effective than other methods when the data varies rapidly. |
Moving window
— Window for smoothing methods
Centered
(default) |Asymmetric
Specify the window type and size for the smoothing method instead of specifying a general smoothing factor.
Window | Description |
---|---|
Centered |
Specified window length centered about the current point. |
Asymmetric |
Specified window containing the number of elements before the current point and the number of elements after the current point. |
Window sizes are relative to theX-axisvariable units.
Version History
Introduced in R2019bSee Also
Functions
Live Editor Tasks
- Clean Missing Data|Clean Outlier Data|Find Change Points|Find Local Extrema|Remove Trends|Normalize Data|Compute by Group