Submitted by Champagne on Thu, 06/23/2011 - 19:35

各位老师好，请教两个关于ALFF的问题，谢谢：

1、我查看了REST里面的ALFF源程序，计算能量谱 = 2 * 频谱的平方 / N，请问这里为什么要除以N？

2、左西年老师的文章《The oscillating brain: Complex and reliable》中Fig1和公式（1）提到ALFF是Sum of amplitudes of PSD，而源程序里ALFF貌似是Mean of amplitudes of PSD，应该以哪个为准？

Submitted by restbrain on Wed, 07/06/2011 - 06:55 Permalink

## Both issues are somewhat

Both issues are somewhat related to constant-scaled ALFF. It should not matter the whole brain map (particularly the normalized version), NO?

Submitted by YAN Chao-Gan on Thu, 07/07/2011 - 00:50 Permalink

## Re

Hi!

I agree with Dr. Zuo.

By the way, I post the following email here in case your are intrerested.

Dear Zhiguo,

If you want to calculate the amplitude by using MATLAB's fft, you need to use 2*abs(fft(x))/N, because MATLAB does not scale the output of fft by the length of the input.seth/2009/01/30/mathworks-conversations-and-the-fft/ )

(see: http://blogs.mathworks.com/

Here, we used 2*abs(fft(x))^2/N to calculate the power spectrum, the result is the same as matlab's PSD program, however, it's N times the results of matlab's periodogram program.

In our program, the ALFF calculated by sqrt(2*abs(fft(x))^2/N) is sqrt(2/N) times of the real amplitude.

In fALFF program, the factor sqrt(2/N) will be removed because fALFF is ALFF(interested)/ALFF(total).

In ALFF program, the ALFF normalized by the global mean (i.e., mALFF) is mostly used, then the factor sqrt(2/N) will be also removed.

As Xiao-Wei said, he wrote the original codes with some history reasons. I did not revised this part and I think the factor sqrt(2/N) have not so bad influence (in most cases, it will be removed). I will talk to Professor Zang about this issue to check if we need to revise this part in the future.

Best wishes!

Chao-Gan

On Wed, Feb 16, 2011 at 3:14 AM, Jiang, Zhiguo wrote:

Hi, Chao-gan

I think the confusion comes from these two lines of code

(see hightlighted).

So to correctly estimate the amplitude, we should take into account of the harmonicas of the signal frequency. That’s why we need to multiply by 2 to get the ‘true’amplitude.

I attached a screenshot of an example bellow .

Note that the original amplitude is 0.7 and 1 , so to correct that we need to multiply the amplitude (abs(Y)) by 2 .

So my question is, my in the codes, the power (not the abs(..)) gets multiplied by a factor 2. That doesn’t look all right to me. As a result (after a subsequent sqrt(..)), the fALFF are scaled by a factor of 1/sqrt(2).

Correct me if I was wrong.

Anyway, it is a great toolbox.

Best,

Tony

From:YAN Chao-GanSent:Sunday, February 13, 2011 11:15 PMTo:Jiang, ZhiguoSubject:Re: REST toolboxDear Dr. Jiang,

Happy Chinese New Year!

Sorry for the delay because of the Chinese Spring Festival Holiday.

As described in the original article:

Zang, Y.F., He, Y., Zhu, C.Z., Cao, Q.J., Sui, M.Q., Liang, M., Tian, L.X., Jiang, T.Z., Wang, Y.F., 2007. Altered baseline brain activity in children with ADHD revealed by resting-state functional MRI. Brain Dev 29, 83-91.

Next, the filtered time series was transformed to a frequency domain with a fast Fourier transform (FFT) (parameters: taper percent = 0, FFT length = shortest) and the power spectrum was then obtained. Since the power of a given frequency is proportional to the square of the amplitude of this frequency component of the original time series in the time domain, the square root was calculated at each frequency of the power spectrum and the averaged square root was obtained across 0.01–0.08 Hz at each voxel.

Here,

theDim1Volume4D =abs(theDim1Volume4D);

theDim1Volume4D =2*(theDim1Volume4D .* theDim1Volume4D) /sampleLength;

was used to calculate the power spectrum.

and then,

theDim1Volume4D =sqrt(theDim1Volume4D);

the square root was obtained.

To my knowledge, the amplitude can also obtained directly as 2*abs(theDim1Volume4D)/sampleLength.

These values are proportional.

Mr. SONG Xiao-Wei wrote these codes originally, may he have any further comments?

Best wishes!

Chao-Gan

On Wed, Feb 2, 2011 at 1:26 AM, Jiang, Zhiguo wrote:

Hi, Dr. Yan

I got a question about the REST toolbox.

To calculate fALFF, first amplitude of the time course in frequency domain need to be computed. In

f_alff.m , the amplitude was raised to power of 2 (see below)

theDim1Volume4D =abs(theDim1Volume4D);

theDim1Volume4D =2*(theDim1Volume4D .* theDim1Volume4D) /sampleLength;

then sqrt() is applied

theDim1Volume4D =sqrt(theDim1Volume4D);

My experience with FFT tells me that the amplitude should be

2*abs(theDim1Volume4D) if using single sided.

Really appreciate if you can clarify this? I might be missing something here.

REST version: REST_V1.5_101101

Thanks,

Tony