Use the dht function to find the Hartley transform of signals.
The defining sum for the Hartley transform is analogous to the discrete Fourier transform sum.
where N is the number of elements in the real data array x.
Sum of Sine Waves
Find the Hartley transform for a sum of sine waves and compare it with the magnitude of the complex Fourier transform.
1. Define the number of elements.
2. Use the sin function to define the input signal.
3. Plot the signal.
4. Use the dht function to show the discrete frequencies represented in the two sine waves, and then use the center function to shift the DC component to the center.
5. Use the match and max functions to find the discrete frequencies at which the peaks occur, and mark one such point with a vertical and a horizontal marker.
6. Use the dft and center functions to get and center the discrete Fourier Transform.
7. Plot the absolute values of the DFT.
8. Use the match and max functions to find the discrete frequencies at which the peaks occur.
The close relationship between the Hartley transform and the Fourier transform can be demonstrated by showing how to compute phase and magnitude from the Hartley transform. This can be done using a small data set.
Short and Noisy Signal
1. Define and plot a noisy input signal of 7 sample points.
2. Compute and center the discrete Hartley transform.
3. Compute the odd and even parts of the discrete Hartley transform (these formulas assume an odd value of N).
4. Use the angle function to calculate the phase vector.
5. Define the magnitude vector.
6. Use the phase, phasecor, and center functions to create the phase vector.
7. Use the augment function to compare the phase results to that obtained via the Fourier transform.
The phase results agree.
8. Use the dft and center functions to create the magnitude vector.
9. Use the augment function to compare the magnitude results to that obtained via the Fourier transform.
The magnitude results agree.
For a thorough treatment of the Hartley transform and its applications, see Ronald Bracewell, The Hartley Transform (Oxford University Press).