使用REST通过.1D或.txt文件计算ALFF问题。

严老师您好,

我现在有之前处理好的时间序列,我想请问老师如何用REST直接计算时间序列的ALFF?

谢谢

请参考alff函数。

先去线性漂移,假定AllVolume是一条你要计算的时间序列:

AllVolume(:,1) = detrend(AllVolume(:,1));

补0到2的n次方,以进行FFT

AllVolume = [AllVolume;zeros(paddedLength -sampleLength,size(AllVolume,2))];

进行FFT

AllVolume(:,1) = 2*abs(fft(AllVolume(:,1)))/sampleLength;

确定所需频段对应的index:

if (LowCutoff >= sampleFreq/2) % All high included

    idx_LowCutoff = paddedLength/2 + 1;

else % high cut off, such as freq > 0.01 Hz

    idx_LowCutoff = ceil(LowCutoff * paddedLength * ASamplePeriod + 1);

    % Change from round to ceil: idx_LowCutoff = round(LowCutoff *paddedLength *ASamplePeriod + 1);

end

if (HighCutoff>=sampleFreq/2)||(HighCutoff==0) % All low pass

    idx_HighCutoff = paddedLength/2 + 1;

else % Low pass, such as freq < 0.08 Hz

    idx_HighCutoff = fix(HighCutoff *paddedLength *ASamplePeriod + 1);

    % Change from round to fix: idx_HighCutoff  =round(HighCutoff *paddedLength *ASamplePeriod + 1);

end

计算ALFF

ALFF= mean(AllVolume(idx_LowCutoff:idx_HighCutoff,:));