Smooth noisy data in the Live Editor
The Smooth Data task 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 the Smooth Data task to a live script in the MATLAB Live Editor:
On the Live Editor tab, click Task and select the Smooth Data icon .
In a code block in the live script, type a relevant keyword, such as
noisy. Select Smooth Data from the suggested command completions.
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 type
logical, or signed or unsigned integer types such as
When providing a table or timetable for the input data, specify All
supported variables to operate on all variables with a supported type.
Choose All numeric variables to operate on all variables of
double, or signed or unsigned
integer types. To choose specific supported variables to operate on, select
Specified variables and then select the variables
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.
Moving average. This method is useful for reducing periodic trends in data.
|Moving median. This method is useful for reducing periodic trends in data when outliers are present.|
|Gaussian-weighted moving average.|
|Linear regression. This method can be computationally expensive, but it results in fewer discontinuities.|
|Quadratic regression. This method is slightly more computationally expensive than 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 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, 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) |
Specify the window type and size for the smoothing method instead of specifying a general smoothing factor.
|Specified window length centered about the current point.|
|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 the X-axis variable units.
Version HistoryIntroduced in R2019b
R2022a: Live Editor task does not run automatically if inputs have more than 1 million elements
Behavior changed in R2022a
This Live Editor task does not run automatically if the inputs have more than 1 million elements. In previous releases, the task always ran automatically for inputs of any size. If the inputs have a large number of elements, then the code generated by this task can take a noticeable amount of time to run (more than a few seconds).
When a task does not run automatically, the Autorun icon is disabled.
To run a task manually, on the Live Editor tab, click the Run Section button.
To enable running the section automatically, click the Autorun icon. The icon updates to display the enabled state.