Code covered by the BSD License
clear clc n = 1e7; %y = genAR(n, 200, exp(-0.2*(1:200)')/5); y = randn(n, 1); tic; [xtx, xty] = xL(y(2:end), [y(1:end-1) y(1:end-1).^2], [200 100]); beta = inv(xtx)*xty; toc;
Contact us at files@mathworks.com