hadamard

Purpose

Hadamard matrix.

Synopsis

H = hadamard(n)

Description

hadamard(n) returns the Hadamard matrix of order n.

Hadamard matrices have applications in several different areas, including combinatorics, signal processing, and numerical analysis, [1], [2]. They are matrices of 1s and -1s whose columns are orthogonal,

H'*H = n*I
where [n n] = size(H) and I = eye(n,n).

An n-by-n Hadamard matrix with n > 2 exists only if rem(n,4) = 0. This function handles only the cases where n, n/12, or n/20 is a power of 2.

Examples

hadamard(4) is the 4-by-4 matrix

    1    1    1    1
    1   -1    1   -1
    1    1   -1   -1
    1   -1   -1    1
contour(hadamard(32)) is a plot reminiscent of a Navajo rug.

See Also

compan, hankel, toeplitz

References

[1] H. J. Ryser, Combinatorial Mathematics, John Wiley and Sons, 1963.

[2] W. K. Pratt, Digital Signal Processing, John Wiley and Sons, 1978.

(c) Copyright 1994 by The MathWorks, Inc.