Products & Services Solutions Academia Support User Community Company

Learn more about System Identification Toolbox   

Handling Offsets and Trends in Data

When to Detrend Data

Detrending is removing means, offsets, or linear trends from regularly sampled time-domain input-output data signals. This data processing operation helps you estimate more accurate linear models because linear models cannot capture arbitrary differences between the input and output signal levels. The linear models you estimate from detrended data describe the relationship between the change in input signals and the change in output signals.

For steady-state data, you should remove mean values and linear trends from both input and output signals.

For transient data, you should remove physical-equilibrium offsets measured prior to the excitation input signal.

Remove one linear trend or several piecewise linear trends when the levels drift during the experiment. Signal drift is considered a low-frequency disturbance and can result in unstable models.

You should not detrend data before model estimation when you want:

To simulate or predict the linear model response at the system operating conditions, you can restore the removed trend to the simulated or predicted model output using the retrend command.

For more information about handling drifts in the data, see the chapter on preprocessing data in System Identification: Theory for the User, Second Edition, by Lennart Ljung, Prentice Hall PTR, 1999.

Alternatives for Detrending Data in GUI or at the Command-Line

You can detrend data using the System Identification Tool GUI and at the command line using the detrend command.

Both the GUI and the command line let you subtract the mean values and one linear trend from steady-state time-domain signals.

However, the detrend command provides the following additional functionality (not available in the GUI):

To learn how to detrend data, see:

How to Detrend Data Using the GUI

Before you can perform this task, you must have regularly-sampled, steady-state time-domain data imported into the System Identification Tool GUI. See Importing Time-Domain Data into the GUI). For transient data, see How to Detrend Data at the Command Line.

  1. In the System Identification Tool, drag the data set you want to detrend to the Working Data rectangle.

  2. Detrend the data.

    • To remove linear trends, select Preprocess > Remove trends.

    • To remove mean values from each input and output data signal, select Preprocess > Remove means.

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.

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

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

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.

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

    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

detrend

TrendInfo

Next Steps After Detrending

After detrending your data, you might do the following:

  


Recommended Products

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