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 aniddataobject. SeeRepresenting Time- and Frequency-Domain Data Using iddata Objects.

Note

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

Use thedetrendcommand to remove the signal means or linear trends:

[data_d,T]=detrend(data,Type)

wheredatais the data to be detrended. The second input argumentType=0removes signal means orType=1removes linear trends.data_dis the detrended data.Tis aTrendInfoobject 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)

    whereTis aTrendInfoobject.

  2. Assign offset values toT.

    T.InputOffset=I_value; T.OutputOffset=O_value;

    whereI_valueis the input offset value, andO_valueis the input offset value.

  3. Remove the specified offsets fromdata.

    data_d = detrend(data,T)

    where the second input argumentTstores the offset values as its properties.

See Also

|

Related Topics