Documentation Center

  • Trial Software
  • Product Updates

getTrend

Data offset and trend information

Syntax

T = getTrend(data)
T = getTrend(data,0)
T = getTrend(data,1)

Description

T = getTrend(data) constructs a TrendInfo object to store offset, mean, or linear trend information for detrending or retrending data. You can assign specific offset and slope values to T.

T = getTrend(data,0) computes the means of input and output signals and stores them as InputOffset and OutputOffset properties of T, respectively.

T = getTrend(data,1) computes a best-fit straight line for both input and output signals and stores them as properties of T.

Examples

Compute input-output signal means, store them, and detrend the data:

% Load SISO data containing vectors u2 and y2
load dryer2
% Create data object with sampling time of 0.08 sec
data=iddata(y2,u2,0.08)
% Plot data on a time plot - it has a nonzero mean
plot(data)
% Compute the mean of the data
T = getTrend(data,0)
% Remove the mean from the data
data_d = detrend(data,T)
% Plot detrended data on the same plot
hold on
plot(data_d)

Remove a specific offset from input and output data signals:

% Load SISO data containing vectors u2 and y2
load dryer2
% Create data object with sampling time of 0.08 sec
data=iddata(y2,u2,0.08)
plot(data)
% Create a TrendInfo object for storing offsets and trends
T = getTrend(data)
% Assign offset values to the TrendInfo object
T.InputOffset=5;
T.OutputOffset=5;
% Subtract specific offset from the data
data_d = detrend(data,T)
% Plot detrended data on the same plot
hold on
plot(data_d)

See Also

| |

Was this topic helpful?