How to do a Amplitude Adjusted Fourier Transform on time series?

13 ビュー (過去 30 日間)
Mir Sahand
Mir Sahand 2024 年 12 月 6 日
コメント済み: Paul 2025 年 1 月 4 日
I need to use MATLAB (R2022b) to surrogate my data (1x500 excel) using Amplitude Adjusted Fourier Transform.
Any advice how to do that?

回答 (1 件)

Jaimin
Jaimin 2025 年 1 月 3 日
To surrogate your data using the Amplitude Adjusted Fourier Transform (AAFT) in MATLAB, you will need to perform the AAFT algorithm, which involves randomizing the phases of the Fourier transform of your data and then adjusting the amplitude.
For understanding kindly refer following code.
% Step 1: Import Data
filename = 'your_data.xlsx'; % Replace with your file name
data = readtable(filename);
% Ensure data is a row vector
if size(data, 1) > 1
data = data';
end
% Step 2: AAFT Algorithm
% Sort the original data
sortedData = sort(data);
% Randomize the original data
randomizedData = data(randperm(length(data)));
randomizedFFT = fft(randomizedData);
% Randomize the phases
randomizedPhases = angle(randomizedFFT);
amplitudes = abs(randomizedFFT);
randomizedFFT = amplitudes .* exp(1i * randomizedPhases);
% Inverse Fourier Transform
surrogateData = ifft(randomizedFFT, 'symmetric');
% 2.6: Adjust the amplitude by sorting
[~, sortIndex] = sort(surrogateData);
surrogateData(sortIndex) = sortedData;
For more information kindly refer following MathWorks documentation.
  1 件のコメント
Paul
Paul 2025 年 1 月 4 日
Do you have source for this code/algorithm? I'm curious about a few things.
rng(100);
% Step 1: Import Data
data = 1:10;
data = data(randperm(10));
% Step 2: AAFT Algorithm
% Sort the original data
sortedData = sort(data);
% Randomize the original data
randomizedData = data(randperm(length(data)));
randomizedFFT = fft(randomizedData);
temp = randomizedFFT;
Nothing is being randomized here. All this code does is recreate the randomizedFFT (to withing numerical precision).
% Randomize the phases
randomizedPhases = angle(randomizedFFT);
amplitudes = abs(randomizedFFT);
randomizedFFT = amplitudes .* exp(1i * randomizedPhases);
norm(temp-randomizedFFT)
ans = 8.2441e-15
% Inverse Fourier Transform
surrogateData = ifft(randomizedFFT, 'symmetric');
% 2.6: Adjust the amplitude by sorting
[~, sortIndex] = sort(surrogateData);
surrogateData(sortIndex) = sortedData;
Consequently, surrogateData is identical to randomizedData.
randomizedData
randomizedData = 1×10
2 7 9 6 3 4 10 8 5 1
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
surrogateData
surrogateData = 1×10
2 7 9 6 3 4 10 8 5 1
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
It's unclear as to why any more code is needed after randomizedData is computed.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by