Discrete Fourier transform

后端 未结 2 1488
甜味超标
甜味超标 2021-02-01 03:33

I am currently trying to write some fourier transform algorithm. I started with a simple DFT algorithm as described in the mathematical definition:

public class          


        
2条回答
  •  無奈伤痛
    2021-02-01 04:25

    What you are experiencing is called Spectral Leakage.

    This is caused because the underlying mathematics of the Fourier transform assumes a continuous function from -infinity to + infinity. So the range of samples you provide is effectively repeated an infinite number of times. If you don't have a complete number of cycles of the waveform in the window the ends won't line up and you will get a discontinuity which manifests its self as the frequency smearing out to either side.

    The normal way to handle this is called Windowing. However, this does come with a downside as it causes the amplitudes to be slightly off. This is the process of multiply the whole window of samples you are going to process by some function which tends towards 0 at both ends of the window causing the ends to line up but with some amplitude distortion because this process lowers the total signal power.

    So to summarise there is no error in your code, and the result is as expected. The artefacts can be reduced using a window function, however this will effect the accuracy of the amplitudes. You will need to investigate and determine what solution best fits the requirements of your project.

提交回复
热议问题