| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
ts = detrend(ts1,method)
ts = detrend(ts1,Method,Index)
ts = detrend(ts1,method) subtracts either a mean or a best-fit line from time-series data, usually for FFT processing. Method is a string that specifies the detrend method and has two possible values:
'constant' — Subtracts the mean
'linear' — Subtracts the best-fit line
ts = detrend(ts1,Method,Index) uses the optional Index integer array to specify the columns or rows to detrend. When ts.IsTimeFirst is true, Index specifies one or more data columns. When ts.IsTimeFirst is false, Index specifies one or more data rows.
You cannot apply detrend to time-series data with more than two dimensions.
![]() | detrend | deval | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |