a) How can you preallocate vector3d arrays
% is there a way to create an array of vector3d zeros
% although this does not seem to work correctly
nn=181
pSH = zeros(nn);
b) How should one correctly assign a vector3d element of array in for loop where ps1 and ps2 are vector3d arrays from MTEX velocity function
for i=1:nn
% angle between SKS_prop_dirn vector and fastest S-wave polarization direction ps1
Z_to_ps11 = angle(SKS_prop_dirn,ps1(i),'antipodal')*180.0/pi
% assign SH polarization parallel or near to plane, angle with plane normal Z > 45 degrees
if(Z_to_ps11 > 45.0)
SH(i)=vs1(i);
pSH(i)=ps1(i);
SV(i)=vs2(i);
pSV(i)=ps2(i);
else
SH(i)=vs2(i);
pSH(i)=ps2(i);
SV(i)=vs1(i);
pSV(i)=ps1(i);
end
end
c) why does pSH_max have dimensions of 181 when I was expecting one vector3d ?
pSH_max = pSH(index_max);