Real World Application:The Fourier Transform
Compute a specified number of terms of the discrete Fourier transform (h1,h2) of the function g. If g(t) is defined for t = 0, 1, …, r-1, the functions h1 and h2 are defined by the formulas
h1(s) = ? g(t) cos(2?st/r)
h2(s) = ? g(t) sin(2?st/r)
for s = 0,1, …, r-1. The values h1(s) and h2(s) for s = 0, 1, …, r-1 are called the Fourier coefficients for g.
Print the amplitude spectrum
(h1[s]2 + h2[s]2)1/2
for the Fourier coefficients that were computed.