Main Content

hadamard

Hadamard matrix

Description

H = hadamard(n) returns the Hadamard Matrix of order n.

example

H = hadamard(n,classname) returns a matrix of class classname, which can be either 'single' or 'double'.

Examples

collapse all

Compute the 4-by-4 Hadamard matrix.

H = hadamard(4)
H = 4×4

     1     1     1     1
     1    -1     1    -1
     1     1    -1    -1
     1    -1    -1     1

Input Arguments

collapse all

Matrix order, specified as a scalar, nonnegative integer.

Example: hadamard(4)

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical

Matrix class, specified as either 'double' or 'single'.

Example: hadamard(4,'single')

Data Types: char

Limitations

  • 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.

More About

collapse all

Hadamard Matrix

Hadamard matrices are matrices of 1's and -1's whose columns are orthogonal,

H'*H = n*I

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

They have applications in several different areas, including combinatorics, signal processing, and numerical analysis [1], [2].

References

[1] Ryser, Herbert J. Combinatorial Mathematics. Mathematical Association of America, 1963.

[2] Pratt, William K. Digital Signal Processing. New York, NY: John Wiley and Sons, 1978.

Extended Capabilities

Version History

Introduced before R2006a

See Also

| |