Hello, I'd like to create a matrix that increases with every loop by concatenation the matrix to itself, starting from an empty matrix as shown below
Q1s = [];alphas = [];for y = ymin:0.5:ymax x = (xmin:2.5e-13:xmax)'; Q1s = vertcat(Q1s,x); alphas = vertcat(alphas,ones(size(x))*y);end
Now I'm getting the famous "consider pre-allocating for speed" message. But I need Q1 and alpha to be empty matrices to begin with because I'm using vertcat. Is there a way to go about this?
Best Answer