I need a 3 dimensional matrix but the first dimensions are not the same. So I have say NxT1 (N by T1) , NxT2 NxT3 and NxT4. and I want to put them in one matrix so can I loop through each dimension. Here is my code:
y2(:,:,1) = zeros(N,T2(:,1));
y2(:,:,2) = zeros(N,T2(:,2));
y2(:,:,3) = zeros(N,T2(:,3));
y2(:,:,4) = zeros(N,T2(:,4));
y2(:,1,:) = c/(1-rho);
for z=1:size(T2,2)
for i=2:T2(:,z)
for j=1:N
y2(j,i,z) = y2(j,i-1)+randn;
end
end
end
I want random walks for different time horizons basically. T2=[50,100,150,200] so my 3 dimensional matrix would contain N simulations for 4 different time specifications.