Learn R Programming

pracma (version 1.9.3)

hadamard: Hadamard Matrix

Description

Generate Hadamard matrix of a certain size.

Usage

hadamard(n)

Arguments

n
An integer of the form 2^e, 12*2^e, or 20*2^e

Value

Matrix of size n-by-n of orthogonal columns consisting of 1 and -1 only.

Details

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.

See Also

hankel, Toeplitz

Examples

Run this code
hadamard(4)
H <- hadamard(8)
t(H) 

Run the code above in your browser using DataLab