%% Apply the HP Filter to Time Series Data
% Plot the cyclical component of the U.S. post-WWII seasonally-adjusted real GNP. In hpfilter, specify that smoothing is 1600, which is appropriate for quarterly data.

load Data_GNP
gnpDate = dates;
realgnp = DataTable.GNPR;
[~,c] = hpfilter(realgnp,1600);

plot(gnpDate,c) 
axis tight

% Copyright 2015 The MathWorks, Inc.