Hi, I have the following loop. Does anyone know how to avoid the output to be overwritten in each iteration, and instead get x1, x2, …, x5 as output?
N=5 T=5 for n=1:N x=NaN*ones(T,1) c=0.3 sigma=1 rho=0.98 x(1)=c/(1-rho) for t=1:T x(t+1)=c+rho*x(t)+sigma*randn(1) end end
Best Answer