# How to create a 3D random complex array with conjugate symmetry in matlab or other languages

For a 3D array A to be conjugate symmetry, then A = conj(A([1 nx:-1:2],[1 ny:-1:2], [1 nz:-1:2])) for A having size nx,ny,nz.

I will be so happy if I get help on this.

New contributor
Emmanuel is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
• What have you tried? Which step are you stuck on? – Wolfgang Bangerth Dec 5 at 16:44
• First, I created A without conjugate symmetry and produce an array B = conj(A([1 nx:-1:2],[1 ny:-1:2], [1 nz:-1:2])). I am trying to replace some element of A with B so as to satisfy the conjugate symmetry. But this approach didnt work. – Emmanuel Dec 5 at 17:26
• Do you know how to create a random symmetric 2D matrix? – Christian Clason Dec 5 at 21:42
• I found this code which does it in 2D: H is a complex matrix with conjugate symmetry H(1,1) = 0; H(1,m/2+1) = 0; H(n/2+1,m/2+1) = 0; H(n/2+1,1) = 0; H(2:end,2:m/2) = rot90(H(2:end,m/2+2:end),2); H(1,2:m/2) = rot90(H(1,m/2+2:end),2); H(n/2+2:end,1) = rot90(H(2:n/2,1),2); H(n/2+2:end,m/2+1) = rot90(H(2:n/2,m/2+1),2); – Emmanuel Dec 6 at 8:10
• By the way, the Matlab idiom A([1 end:-1:2],[1 end:-1:2], [1 end:-1:2]) may be useful to you when you work with this kind of constructs. – Federico Poloni Dec 6 at 19:52