In the theory of block codes intended for error detection or error correction, a distance measure analogous to the Hamming distance but modelling more accurately a linear q-ary channel, such as the phase-modulated carrier used in modems. When q = 2 or q = 3, the Lee and Hamming distances are the same.