# [FieldTrip] Spectrum normalization

Wunderle, Thomas thomas.wunderle at esi-frankfurt.de
Tue Oct 20 16:58:25 CEST 2015

```Hi all,

I have a question about how FieldTrip normalizes the output of a spectral analyses using ft_freqanalysis.
This is important for me, because I need the absolute value of the spectrum for a publication.

I was scanning through the code trying to find the normalization steps.
In particular, I don't understand the following steps:

1.)    The tapers (e.g. hanning) are normalized prior to the multiplication with the data by the following code:
tap = tap./norm(tap, 'fro');   (line 195 in the function fr_specest_mtmfft)
What is the rationale of dividing through this special norm of the taper itself?

2.)    After calculating the fft, the specrum is scaled (i.e. in the function fr_specest_mtmfft) by:

dum = dum .* sqrt(2 ./ endnsample);  (line 251)

Later on, to get to the power spectrum, the abs of the spectrum is taken and squared

powdum = abs(spectrum(acttap,:,foiind(ifoi),acttboi)) .^2; (line 629 in ft_frequanalysis)

This puzzles me, because scanning through the literature, the power spectrum should be given by

(2*abs(X)^2) ./ (nfft^2)                -> unit: V^2        (X=signal, nfft = number of data points)

and the PSD by

(2*abs(X)^2) ./ (nfft*Fs)              -> unit: V^2/Hz (X=signal, nfft = number of data points, Fs=sampling rate)

Alternatively, one can get the amplitude spectrum from the power spectrum by taking the square root of the PSD:

sqrt(PSD)                             -> unit: V/sqrt(Hz)

which is still different from

(2*abs(X)) ./ (nfft*Fres)               -> unit: V/Hz ?   (Fres = frequency resolution = Fs/nfft)

The result of these equations are different from what comes out of the FieldTrip code.

So what is the unit of the spectrum in FieldTrip?

What is the rationale of scaling the complex spectrum by sqrt(2/nfft) ?

Furthermore, is the unit for the different spectral estimation methods the same? That is, using mtmfft, mtmconvol, wavelet,...?

It would help me a lot if someone could clarify these points.

Thomas

-----
Dr. Thomas Wunderle
Ernst Strüngmann Institute (ESI) for Neuroscience<http://www.ncbi.nlm.nih.gov/feed/rss.cgi?ChanKey=PubMedNews>
in Cooperation with Max Planck Society <http://www.ncbi.nlm.nih.gov/feed/rss.cgi?ChanKey=PubMedNews>
Deutschordenstrasse 46
60528 Frankfurt am Main, Germany
www.esi-frankfurt.de<http://www.esi-frankfurt.de/>
thomas.wunderle at esi-frankfurt.de<mailto:thomas.wunderle at esi-frankfurt.de>
Tel:   +49 69 96769 516
Fax:   +49 69 96769 555

Sitz der Gesellschaft: Frankfurt am Main
Registergericht: Amtsgericht Frankfurt - HRB 84266
Geschäftsführer: Prof. Dr. Pascal Fries

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20151020/eebaf460/attachment-0001.html>
```