It looks to me as though the line
H(t) = rand(M(t),K) + i*rand(M(t),K);
is in error. On the first trip through that for-loop, you are trying to stuff a 100 x 5 matrix into what appears to be a scalar location in vector H. How do you expect it to fit? Better think that step over again more carefully.