MATLAB: How to create a circulant matrix of shift 3 towards the left

tag

Hi,
Does anyone know how do I create a circulant matrix like the one I attached. The first 2 row is for the x-axis, center 2 row is for the y-axis and the last 2 row is for the z-axis. The shift from each row is 3. The x-axis started from 1st column. The y-axis started from 2nd column and the z-axis started from 3rd column.

Best Answer

Not very flexible:
A = eye(6)
A = A([1 4 2 5 3 6],:) % permute as desired
A(:,10) = 0 % add some zero columns