# Does the power analysis by FFT yield edge artefacts?

Hi Mike and everyone,

I was reading Analyzing Neural Time Series Data, and I understand that you’ll get an edge artefact/effects via wavelet or Fourier transform for a time-frequency analysis (I also saw this youtube clip - thank you for uploading these!). But what if you are only looking at a frequency domain? (i.e. when doing a power or frequency analysis?)

I was told that I don’t need a buffer zone at either end of the epochs for a frequency analysis. I’m trying to understand why.
My guess is that the fast Fourier transform does create edge artefact but it doesn’t matter because a frequency analysis discards the temporal information of the data?
But then I struggle to understand why the artefact/contaminated data (like, higher voltage) at the beginning and the end of the epoch would only affect the temporal spectrum but not the power spectrum so when you do a power analysis you don’t need to think about the edge artefacts?

I am so sorry if this is a silly question!

Hi Saya. Buffer zones are only useful for time-frequency analysis; you don’t need them for spectral-only analysis.

As for windowing, that’s trickier. The issue is that sharp edges, including at the boundaries, require additional energy at a wider range of frequencies to represent. Tapering the data with a window is good because it attenuates edge effects. But it also results in data loss. So if the epochs are relatively short (e.g., Welch’s method), then tapering is a good idea. If you’re taking the FFT of a really long time segment, then the edge effects are likely to be relatively small, and thus taking tapering might do more harm than good.

You can run the following MATLAB code to see an example – or just look at the screenshot below that. Keep in mind that both results are valid; they are just different.

``````s = sin(0:.1:2*pi)>0;
w = hann(length(s))';
h = (0:length(s)-1)/length(s);

subplot(211)
plot(h,s, h,s.*w, 'linew',3)
title('Time domain')
legend({'Square wave','Tapered'})

subplot(212)
plot(h,abs(fft(s)), h,abs(fft(s.*w)), 'linew',3)
title('Frequency domain')
``````

1 Like

Thank you Mike! I’ll be extracting 2sec time intervals so I might need tapering but I’ll have a think. Again thanks so much for your help and the code!