In your code, you are creating ten arrays oflong (should rename this variable to make it more clear what it represents). This is then equivalent to a single 10 x m array (where m is the length of yourX) which should be just
v_a = normrnd(0,1,10,length(X));
Then, in yourfor loops, you can just reference the appropriate column ofv_a instead of trying to figure out which array variable you will need.
Best Answer