Digital Signal Processing Using MATLAB and Wavelets

Chapter 9.3.2 - How The Haar Transform Affects a Point's Angle

To see how the angle changes for the Haar transform, we will start again with the point $(1, 10)$, which we know becomes $\left(\frac{11}{\sqrt{2}}, \frac{-9}{\sqrt{2}}\right)$ in the Haar-domain. What are the angles that these points make with respect to their x-axes? The formula for finding the angles (labeled $theta$) is given below. Note that atan finds the arctangent.
    if (x > 0) 
       theta = atan (y/x)  
    elseif (x < 0) 
       if (y < 0) 
          theta = atan (y/x) - pi
       else 
          theta = atan (y/x) + pi
       end 
    else 
       % The vector lies on the y-axis. 
       theta = sign(y)*(pi/2) 
    end

The angle made by the Cartesian coordinates $(1, 10)$ is $84.29^{\circ}$. The angle made by the same coordinates after the Haar transform is
$tan^{-1}\left(\frac{-9}{11}\right) = -39.29^{\circ}$.

Looking at the relationship between the two in general, the $Angle_{Cartesian} = tan^{-1}\left(\frac{y}{x}\right)$, while the $Angle_{Haar} = tan^{-1}\left(\frac{(x-y)/\sqrt{2}}{(x+y)/\sqrt{2}}\right)$$= tan^{-1}\left(\frac{x-y}{x+y}\right)$.

The formula above is rather cumbersome to deal with, due to the ambiguous nature of the arctan function, and because of a potential divide-by-zero problem when $x = 0$. For the first consideration, this becomes a little easier when we replace $x$ and $y$ with their polar coordinate equivalents. That is, we will replace $x$ and $y$ with $r \cos(\theta_1)$ and $r \sin(\theta_1)$, respectively. The Haar-domain values are then $r (\cos(\theta_1) + \sin(\theta_1)) / \sqrt{2}$ and $r (\cos(\theta_1) - \sin(\theta_1)) / \sqrt{2}$, respectively. Finding the new angle (the Haar-domain angle, $\theta_2$), we plug the Haar-domain values from above into the equation $\theta = tan^{-1}(\frac{y}{x})$ to find:

\begin{displaymath}\theta_2 = tan^{-1}\left(\frac{r (\cos(\theta_1) - \sin(\thet...
...t{2}}{r(
\cos(\theta_1) + \sin(\theta_1)) / \sqrt{2}}\right) . \end{displaymath}

An interesting thing to notice is that the term $r/\sqrt{2}$ cancels itself out, meaning that the radii of the polar values do not matter. In other words, the value for $\theta_2$ depends solely on $\theta_1$. This should be expected, since we already know from section 9.3.1 that the two radii are equal. So the equation for $\theta_2$ simplifies to:

\begin{displaymath}\theta_2 = tan^{-1}\left(\frac{\cos(\theta_1) - \sin(\theta_1)}{\cos(\theta_1) + \sin(\theta_1)}\right) . \end{displaymath}

We can divide by $\cos(\theta_1)$, giving us:

 

\begin{displaymath}\theta_2 = tan^{-1}\left(\frac{\frac{\cos(\theta_1)}{\cos(\th...
...cos(\theta_1)} + \frac{\sin(\theta_1)}{\cos(\theta_1)}}\right) \end{displaymath}


\begin{displaymath}\theta_2 = tan^{-1}\left(\frac{1 - \frac{\sin(\theta_1)}{\cos(\theta_1)}}{1 + \frac{\sin(\theta_1)}{\cos(\theta_1)}}\right) . \end{displaymath}

We then replace $\frac{\sin(\theta_1)}{\cos(\theta_1)}$ with $tan(\theta_1)$:

\begin{displaymath}\theta_2 = tan^{-1}\left(\frac{1 - tan(\theta_1)}{1 + tan(\theta_1)}\right) . \end{displaymath}

Since $tan(\pi/4) = 1$, we will replace the $1$ in the numerator. Also in the denominator, $tan(\theta_1) = 1 \times tan(\theta_1) = tan(\pi/4) tan(\theta_1)$. This gives us:


\begin{displaymath}\theta_2 = tan^{-1}\left(\frac{tan(\pi/4) - tan(\theta_1)}{1 + tan(\pi/4) tan(\theta_1)}\right) . \end{displaymath}

Now comes the point of all this manipulation. There is a trigonometric identity2 that says:

\begin{displaymath}tan(\alpha - \beta) = \frac{tan(\alpha) - tan(\beta)} {1 + tan(\alpha) tan(\beta)} . \end{displaymath}

It is no coincidence that the right side of the above identity looks a lot like part of our expression for $\theta_2$. Once we use this identity, it simplifies our equation:

\begin{displaymath}\theta_2 = tan^{-1}(tan( \pi/4 - \theta_1 ) ) \end{displaymath}

\begin{displaymath}\theta_2 = \pi/4 - \theta_1 . \end{displaymath}

This says what we expect it to; that the Haar transform is a rotation by $\pi/4$ radians, or 45 degrees.

2Thanks to Mr. Srikanth Tirupathi for pointing this out.

< Previous Excerpt Next Excerpt >
Purchase This Book

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: DSP Boards
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.