Discrete Walsh-Hadamard Transform in Signal ...

145 downloads 0 Views 445KB Size Report
Feb 3, 2012 - Abstract. The Walsh-Hadamard transform (WHT) is an orthogonal transformation that ... initially constructed by James Joseph Sylvester in 1867.
IJRIT International Journal of Research in Information Technology, Volume 1, Issue 1, January 2013, Pg. 80-89

Discrete Walsh-Hadamard Transform in Signal Processing A.A.C.A.Jayathilake 1, A.A.I.Perera 2, M.A.P.Chamikara 3

3

1

Department of Mathematics, University of Peradeniya, Peradeniya, Sri Lanka [email protected]

2

Department of Mathematics, University of Peradeniya, Peradeniya, Sri Lanka [email protected]

Postgraduate Institute of Science, University of Peradeniya, Peradeniya, Sri Lanka [email protected]

Abstract The Walsh-Hadamard transform (WHT) is an orthogonal transformation that decomposes a signal into a set of orthogonal, rectangular waveforms called Walsh functions. The transformation has no multipliers and is real because the amplitude of Walsh (or Hadamard) functions has only two values, +1 or -1.Therefore WHT can be used in many different applications, such as power spectrum analysis, filtering, processing speech and medical signals, multiplexing and coding in communications, characterizing non-linear signals, solving non-linear differential equations, and logical design and analysis. An orientation on the use of Hadamard matrix and Walsh matrix for the computer assisted signal processing of a particular signal is proposed here. The structure of the Walsh matrices and Hadamard matrices are briefly discussed. Keywords- Hadamard Matrices, Image Processing, Transformations, Walsh Matrices

1. Introduction Hadamard Matrix [1]: A square matrix whose entries are either +1 or −1 and whose rows are mutually orthogonal is called the Hadamard matrix. In combinatorial terms, it explains that every two different rows have matching entries in exactly half of their columns and mismatched entries in the remaining columns. A Hadamard matrix has maximal determinant among matrices. Hadamard matrix H of order n satisfies Where In is the n × n identity matrix and HT is the transpose of H. If is a Hadamard matrix of order ,then, or .The examples of small order Hadamard matrices are & Tensor Product [9]: The tensor product or the kronecker product of matrices is defined as

and

80 A.A.C.A.Jayathilake et al, IJRIT

IJRIT International Journal of Research in Information Technology, Volume 1, Issue 1, January 2013, Pg. 80-89

The simplest construction of new Hadamard matrices from old is the Sylvester construction and it was initially constructed by James Joseph Sylvester in 1867. Let H be a Hadamard matrix of order n. Then the partitioned matrix

is a Hadamard matrix of order sequence of Hadamard matrices.

Where

.This observation can be applied repeatedly and leads to the following

denotes the Kronecker product.

Matrices of order constructed using Sylvester’s construction are usually referred to as Sylvester Hadamard matrices. This construction gives the normalized Hadamard matrices for which all the entries in the first row and the first column are ones. Walsh Functions[6]:Walsh functions were initially introduced mathematically by Walsh in 1923.It forms an orthonormal set of rectangular waveforms with values of -1 or +1 on the interval .Hence the corresponding fast algorithms require only addition and subtraction of input values. There are two definitions of Walsh functions defined on the interval .The most usual way to construct Walsh functions on the interval is to use the recursive formula given below.

and recursively for

and

we have,

These formulae can be used to define Walsh functions for any value

and .

The Walsh functions can also be defined using the Sylvester Hadamard matrices. Using such matrices of order , we can define the Walsh functions from to as follows. First divide the interval

in to

sub intervals as follows.

81 A.A.C.A.Jayathilake et al, IJRIT

IJRIT International Journal of Research in Information Technology, Volume 1, Issue 1, January 2013, Pg. 80-89

Then the Walsh function is defined as the row of the Hadamard matrix takes the value 1 in the interval , if or otherwise it takes the value -1. The following example illustrates the above described method of constructing Walsh functions using Sylvester matrices. The smallest order of the Hadamard matrix is matrix as

.Using this matrix we can obtain the next Hadamard

.By the Sylvester construction we get the Hadamard matrix of order 4 as follows.

Similarly,

Next compute,

Where, the first column following the matrix is the index of rows and the next column is the sequency value for which the number of zero crossings (sign changes) in each row. Then, the first 8 Walsh functions can be expressed as follows.

Walsh–Hadamard Transform: The Walsh–Hadamard transform is a non-sinusoidal, orthogonal transformation technique that decomposes a signal into a set of basis functions. These basis functions are

82 A.A.C.A.Jayathilake et al, IJRIT

IJRIT International Journal of Research in Information Technology, Volume 1, Issue 1, January 2013, Pg. 80-89

Walsh functions, which are rectangular or square waves with values of +1 or –1. Walsh–Hadamard transforms are also known as Walsh, or Walsh-Fourier transforms. The Walsh–Hadamard transform returns sequency values. Sequency is a more generalized notion of frequency and is defined as one half of the average number of zero-crossings per unit time interval. Each Walsh function has a unique sequency value. It can be used to estimate the signal frequencies in the original signal. Three different ordering schemes are used to store Walsh functions: sequency, Hadamard, and dyadic. Sequency ordering, which is used in signal processing applications, has the Walsh functions in the order shown in the figure above. Hadamard ordering, which is used in controls applications, arranges them as 0, 4, 6, 2, 3, 7, 5, 1. Dyadic or gray code ordering, which is used in mathematics, arranges them as 0, 1, 3, 2, 6, 7, 5, 4. Natural-ordered (Hadamard Ordered) Walsh [4]

Dyadic-ordered Walsh transforms [5]

Sequency-ordered Walsh transforms [2]

Like the FFT, the Walsh–Hadamard transform has a fast version, the fast Walsh–Hadamard transform (fwht). Compared to the FFT, the FWHT requires less storage space and is faster to calculate because it uses only real additions and subtractions, while the FFT requires complex values. The FWHT is able to represent signals with sharp discontinuities more accurately using fewer coefficients than the FFT. Both the FWHT and the inverse FWHT (ifwht) are symmetric and thus, use identical calculation processes. 2-D Walsh transform is given by,

or

Inverse transform,

83 A.A.C.A.Jayathilake et al, IJRIT

IJRIT International Journal of Research in Information Technology, Volume 1, Issue 1, January 2013, Pg. 80-89

Or

Unlike the Fourier transform, which is based on trigonometric functions, the Walsh transform consist of a series expansion of basis functions whose values are only +1 and -1.

2. Hadamard Transform[7] Hadamard Transform is an example of a generalized class of Fourier transforms. It performs an orthogonal, symmetric, involution, linear operation on 2m real numbers (or complex numbers, although the Hadamard matrices themselves are purely real). The Hadamard transform can be regarded as being built out of size-2 discrete Fourier transforms (DFTs), and is in fact equivalent to a multidimensional DFT of size. It decomposes an arbitrary input vector into a superposition of Walsh functions. In a similar form as the Walsh transform, the 2-D Hadamard transform is defined as,

Inverse transform,

The Hadamard transform differs from the Walsh transform only in the order of basis functions. The order of basis functions of Hadamard transform does not allow fast computation of it by using the straight forward modification of FFT. An extended version of the Hadamard transform is the ordered Hadamard transform for which a fast algorithm called Fast Hadamard transform can be applied.

84 A.A.C.A.Jayathilake et al, IJRIT

IJRIT International Journal of Research in Information Technology, Volume 1, Issue 1, January 2013, Pg. 80-89

Fig. 1.The difference between the Walsh matrix and Hadamard matrix Two important characteristics of the Walsh functions are their compactness (representing the lower order functions requires fewer samples), and the simplicity and quickness of their construction The effectiveness of most of these applications, especially filtering and coding, depends on the ability of the transform to pack signal energy into a few transform coefficients. Today Walsh transform is mainly used in multiplexing which is to send several data simultaneously. It does not require high energy packing ability.

3. Applications In Signal Processing[8] The existence of the Walsh transformation algorithm was essential for the applications of Walsh-function in signal processing. For the following simple signal, the resulting FWHT shows that was created using Walsh functions. x = -pi:0.01:30*pi; y=sin(x); % Generating a signal using the Sin function plot(y);

% Plotting the function (The signal will be just as follows)

Fig.2- sin curve which is used to apply fwht

85 A.A.C.A.Jayathilake et al, IJRIT

IJRIT International Journal of Research in Information Technology, Volume 1, Issue 1, January 2013, Pg. 80-89

x1 = y + 0.5.*randn(1,length(y)); % Adding was generated above

noise to the signal which

plot(x1); % Plotting the new signal (x1)

Fig.3-view of the sin curve after adding some noise n=fwht(x1);% Generating the Fast Walsh-Hadamard transform of the above noisy signal. plot(n); % Plotting the noisy signal (n)

Fig. 4-view of the signal after generating the fwht on the above signal

86 A.A.C.A.Jayathilake et al, IJRIT

IJRIT International Journal of Research in Information Technology, Volume 1, Issue 1, January 2013, Pg. 80-89

Fig.5-zoom view of the above signal

From the plot, it concludes that most of the signal lies in the lower sequency area of the signal. That is approximately below 500. The rest of the things from the above Fast Walsh-Hadamard transform signal (n) can be removed. n(500:length(n)) = 0; % Removing the higher coefficients from signal n. plot(n); % Plotting the signal again.

Fig.6 – View of the signal after removing the higher coefficients. Then, by applying inverse WHT to the above modified signal, the original signal can be found.

87 A.A.C.A.Jayathilake et al, IJRIT

IJRIT International Journal of Research in Information Technology, Volume 1, Issue 1, January 2013, Pg. 80-89

invHad=ifwht(n); % Reconstructing the signal using inverse WalshHadamard Transform plot(invHad); % Plotting the reconstructed signal

Fig.7- Reconstructed signal after applying Inverse WHT

3.1 Communication using Spread Spectrum CDMA, or Code Division Multiple Access, is a modulation format that uses spread spectrum to transmit multiple channels over a common bandwidth. In this technology, the Walsh–Hadamard code is used to define individual communication channels and WHT transforms to dispread them. Since Walsh codes are orthogonal, any Walsh-encoded signal appears as random noise to a terminal unless that terminal uses the same code for encoding.

3.2 ECG signal processing Sometimes, it is necessary to record electro-cardiogram (ECG) signals of patients at different instants of time. ECG signals typically are very large and need to be stored for analysis and retrieval at a future time. Walsh-Hadamard transforms are particularly well-suited to this application because they provide compression and thus, require less storage space, plus they also provide rapid signal reconstruction.

References [1] J.J.Sylvester 1867, 'Thoughts on inverse orthogonal matrices, simultaneous sign succession, and tesselated pavements in two or more colours, with applications to Newton's rule, ornamental tile work, and the theory of numbers.', Phil. Mag 34, pp. 461-475. [2] Harmuth, H.F.(1968),'A Generalized Concept of Frequency and some Applications,' IEEE Trans. on Information Theory, Vol.14, No.3, May 1968, pp.375-382 [3] Matlab Help, accessed on 07th February, 2012 [4] Pratt, W.K., Kane, J., Andrews, H.C.(1969),'Hadamard Transform Image Coding,' Proc. IEEE, Vol.57, No.1, pp.58-68. [5] Shanks, J.L.,(1969) 'Computation of the fast Walsh-fourier Transform,' IEEE Trans. Vol.18, , pp.457459.’ [6] Walsh, J.L.,(1923) 'A closed set of orthogonal functions," American Journal Of Mathematics, Vol.45, pp.5-24.

88 A.A.C.A.Jayathilake et al, IJRIT

IJRIT International Journal of Research in Information Technology, Volume 1, Issue 1, January 2013, Pg. 80-89

[7]www.wikipedia.com, about Walsh functions viewed 3rd of February 2012 http://en.wikipedia.org/wiki/Walsh_function [8] www.mathworks.com, about Hadamard transform viewed on 5th of February 2012. http://www.mathworks.in/products/signal/demos.html?file=/products/demos/shipping/signal/WalshHadama rddemo.html [9] Yamada, JSAM 1992, ' Hadamard matrices, sequences, and block designs', in Contemporary Design Theory: A Collection of Surveys, John Wiley & Sons.

Authors Bibliography A.A.C.A.Jayathilake is an undergraduate at the University of Peradeniya, Sri Lanka. She is following a BSc (Special) degree in Mathematics, University of Peradeniya, Sri Lanka (2013). Her research interests are Combinatorics, Graph theory, Differential equations and design theory.

A.A.I.Perera is a Professor in Mathematics at the Department of Mathematics , University of Peradeniya, Sri Lanka. His research interests are Combinatorics,Graph theory,Design Theory and Group Theory.

M. A. Pathum Chamikara is working as a research assistant at the Post Graduate Institute of Science (PGIS), University of Peradeniya, Sri Lanka. He received his BSc (Special) degree in Computer Science, University of Peradeniya, Sri Lanka (2010). His research interests include Crime analysis, GIS (Geographic Information Systems), image processing, computational mathematics, computer vision and artificial intelligence.

89 A.A.C.A.Jayathilake et al, IJRIT