%% Continuous Linear Trend
% Create a vector of data, and remove the continuous linear trend. Plot the original data, the detrended data, and the linear trend.

t = 0:20;
x = 3*sin(t) + t;
y = detrend(x);
plot(t,x,t,y,t,x-y,':k')
legend('Input Data','Detrended Data','Trend','Location','northwest') 

% Copyright 2018 The MathWorks, Inc.