spike in my inverse fourier transform

2019-05-04 16:15发布

问题:

I am trying to compare two data sets in MATLAB. To do this I need to filter the data sets by Fourier transforming the data, filtering it and then inverse Fourier transforming it.

When I inverse Fourier transform the data however I get a spike at either end of the red data set (picture shows the first spike), it should be close to zero at the start, like the blue line. I am comparing many data sets and this only happens occasionally.

I have three questions about this phenomenon. First, what may be causing it, secondly, how can I remedy it, and third, will it affect the data further along the time series or just at the beginning and end of the time series as it appears to from the picture.

Any help would be great thanks.

回答1:

When using DFT you must remember the DFT assumes a Periodic Signal (As a Superposition of Harmonic Functions). As you can see, the start point is exact continuation of the last point in harmonic function manner.

Did you perform any Zero Padding in the Spectrum Domain? Anyhow, Windowing might reduce the Overshooting.

Knowing more about the filter and the Original data might be helpful.



回答2:

If you say spike near zero frequencies, I answer check the DC component.

You seem interested by the shape, so doing

x = x - mean(x)

or

x -= mean(x)

or

x -= x.mean()

(I love numpy!)

will just constrain the dataset to begin with null amplitude at zero-frequency and to go ahead with comapring the spectra's amplitude.

(as a side-note: did you check that you approprately use fftshift and ifftshift? this has always been the source of trouble for me)



回答3:

Could be the numerical equivalent of Gibbs' phenomenon. If that's correct, there's no way to remedy it except for filtering.