clear all close all set(0,'defaultlinelinewidth',1.5); x = load('gdp_us.txt'); time = x(:,1); gdp = x(:,2); pop = x(:,3); lgdp = log(gdp); n = length(time); %% linerani trend % const = ones(n,1); % t = (1:n)'; % X = [const t]; % % beta = regress(lgdp,X); % lin_trend = X*beta; % cycle = lgdp - lin_trend;