Main Content

How to Detrend Data at the Command Line

Detrending Steady-State Data

Before you can perform this task, you must have time-domain data as an iddata object. See Representing Time- and Frequency-Domain Data Using iddata Objects.


If you plan to estimate models from this data, your data must be regularly sampled.

Use the detrend command to remove the signal means or linear trends:


where data is the data to be detrended. The second input argument Type=0 removes signal means or Type=1 removes linear trends. data_d is the detrended data. T is a TrendInfo object that stores the values of the subtracted offsets and slopes of the removed trends.

Detrending Transient Data

Before you can perform this task, you must have

  1. Create a default object for storing input-output offsets that you want to remove from the data.

    T = getTrend(data)

    where T is a TrendInfo object.

  2. Assign offset values to T.


    where I_value is the input offset value, and O_value is the input offset value.

  3. Remove the specified offsets from data.

    data_d = detrend(data,T)

    where the second input argument T stores the offset values as its properties.

See Also


Related Topics