Fast Walsh-Hadamard transform

`y = fwht(x)`

y = fwht(x,n)

y = fwht(x,n,ordering)

`y = fwht(x)`

returns the coefficients of
the discrete Walsh-Hadamard transform of the input `x`

.
If `x`

is a matrix, the FWHT is calculated on each
column of `x`

. The FWHT operates only on signals
with length equal to a power of 2. If the length of `x`

is
less than a power of 2, its length is padded with zeros to the next
greater power of two before processing.

`y = fwht(x,n)`

returns the `n`

-point
discrete Walsh-Hadamard transform, where `n`

must
be a power of 2. `x`

and `n`

must
be the same length. If `x`

is longer than `n`

, `x`

is
truncated; if `x`

is shorter than `n`

, `x`

is
padded with zeros.

`y = fwht(x,n,ordering)`

specifies the ordering
to use for the returned Walsh-Hadamard transform coefficients. To
specify the ordering, you must enter a value for the length `n`

or,
to use the default behavior, specify an empty vector (`[]`

)
for `n`

. Valid values for the ordering are the following
strings:

Ordering | Description |
---|---|

`'sequency'` | Coefficients in order of increasing sequency value, where each row has an additional zero crossing. This is the default ordering. |

`'hadamard'` | Coefficients in normal Hadamard order. |

`'dyadic'` | Coefficients in Gray code order, where a single bit change occurs from one coefficient to the next. |

For more information on the Walsh functions and ordering, see Walsh-Hadamard Transform.

[1] Beauchamp, Kenneth G. *Applications
of Walsh and Related Functions: With an Introduction to Sequency Theory*.
London: Academic Press, 1984.

[2] Beer, Tom. "Walsh Transforms." *American
Journal of Physics*. Vol. 49, 1981, pp. 466–472.

Was this topic helpful?