# Discrete Fourier Transform

#1

I’m trying to use a discrete Fourier transform to find the main frequency components of some multiply periodic time series data. I want to construct a waveform that contains the main periodic features and use that to normalize out most of the periodc structure. I then plan further analysis on the resulting transformed data.

I’m having issues not with the DFT per se, but with trying to construct the normalization function from the DFT results. I’m using the DFT in Excel for now, but I don’t think that matters at it is pretty standard.

The problems I’m having are:

1. Phase information seems wrong, but not in an obvious way
2. The average of the data set, which should be in the 0 frequency coefficient, is way off. For example, adding 3 sine waves with different phases and amplitudes, the result is a complicated but periodic wave, with average 0 if I don’t add bias to any of the 3 componnets. But the DFT returns the 0 value of, say,700.
3. I’m not sure how to get the amplitudes for the main frequency components. I can do the transform, and the freuquencies are found more or less correctly, but the magnitudes of frequency components are very large, again expecting smaller values. I’m guessing this isn’t the right way to get the magnitudes for reconstruction but I can’t seem to find that.
4. If I hack in the (known) magnitudes of my test case, I get close, but the phase is off and there is some kind of mirroring in the time domain. So I’m not getting the right reconstruction.

If there is anyone here who has experience with DFT I would welcome suggestions. I realize this is a messy question. I’m happy to provide some example data if needed.

#2

I have been able to resolve nearly all the issues, after finding this reference:

I now am getting reasonalble amplitude and phase, and can reconstruct the waveform from just the most significant frequencies identified by the DFT. My remaining issues are:

1. The frequency is off a bit. I can see from the frequency domain plot that the peaks are spread out a bit. In the reference above they mention leakage into adjacent frequencies. At present, if I have, say, sampling rate of 8 Hz over 256 seconds, and after doing the DFT I use 7 Hz in the calcuation of the DFT frequencies, the frequency lines up.

2. The amplitude is a bit low. In one case if I multiply the amplitude by 1.25 it matches. In another case I needed to multiply by 3.5. This may also be a leakage issue.

I hope this information is useful to others.