Find and Remove Trends
Find and remove polynomial or periodic trends from data in the Live Editor
Description
The Find and Remove Trends task lets you interactively identify polynomial or periodic trends in data and return or remove them. The task automatically generates MATLAB® code for your live script. For more information about Live Editor tasks generally, see Add Interactive Tasks to a Live Script.
Using this task, you can:
Identify a polynomial trend in data.
Choose the degree of the polynomial trend to remove from data.
Dynamically arrange breakpoints to define piecewise segments of the data.
Specify continuity constraints.
Visualize and return the computed trends and data with the trends removed.
Identify long-term and periodic, seasonal, or oscillatory trends in data.
Choose the Singular Spectrum Analysis (SSA) or Seasonal Trend Decomposition Using Loess (STL) algorithm to find trends in the data.
Specify the number of periodic trends and lag window when the periods of trends are unknown.
Specify period lengths when the periods of trends are known.
Visualize and return the computed trends and data with the trends removed.
For more information on Live Editor tasks, see Add Interactive Tasks to a Live Script.
Related Functions
Find and Remove Trends generates code that uses the
detrend and trenddecomp
functions.
Open the Task
To add the Find and Remove Trends task to a live script in the MATLAB Editor:
On the Live Editor tab, select Task > Find and Remove Trends.
In a code block in the script, type a relevant keyword, such as
find,remove,detrend,trenddecomp,stl, orssa. SelectFind and Remove Trendsfrom the suggested command completions. Then, select the trend type. For some keywords, the task automatically updates one or more corresponding parameters.
Examples
Related Examples
Parameters
Tips
If your data has seasonal variation that is proportional to the level of the time series, use a
logtransformation on the data before looking for periodic trends.













