MATLAB: Creating Multiple Arrays within a For Loop

arrayfor loops

I'm wondering if there is a way the create multiple new arrays within a for loop.
I have the following equation that I'm trying to use.
The right hand side 3x1s are constant, but there are multiple values of z which then change 3×1 value on the left hand side.
Is there way that I could have z1 give LHS array 1, z2 give LHS array 2 and so within a for loop?

Best Answer

You wouldn't do that with a loop. You would just use vector arithemtic,
eps0=rand(3,1); %fake RHS data
kappa=rand(3,1);
z=rand(1,20);
eps=eps0+kappa*z;
epsxx=eps(1,:);
epsyy=eps(2,:);
gammaxy=eps(3,:);