The spin of a particle is a fundamental property in quantum physics. We shall inspect below matrix representations of such spin operators.
Suppose you have integer or half-integer spin of value s. The matrices Sx, Sy and Sz representing it have the following properties:
See also this article for more reference.
[Sx,Sy,Sz] = spin_matrices(1/2)
Sx = 0 0.5 0.5 0
Sy = 0 -0.5i 0.5i 0
Sz = 0.5 0 0 0.5
The usual cheats are not allowed!