How to replace fftn and ifftn with parallel statements
조회 수: 3 (최근 30일)
이전 댓글 표시
I basically understand that fftn can be replaced by the following code, but how is ifftn implemented?
psi=rand(10,10,10);
% costly way
fftpsi=fftn(psi);
% This might save you some RAM, to be tested
[m,n,p] = size(psi);
for k=1:p
psi(:,:,k) = fftn(psi(:,:,k));
end
psi = reshape(psi,[m*n p]);
for i=1:m*n % you might work on bigger row-block to increase speed
psi(i,:) = fft(psi(i,:));
end
psi = reshape(psi,[m n p]);
댓글 수: 0
답변 (1개)
Sanju
2024년 2월 15일
The “ifftn” function in MATLAB is implemented using a similar approach as the code you provided for “fftn” It performs the inverse Fourier transform on each slice of the input array along the specified dimensions.
Here's an example of how you can implement “ifftn” ,
psi = rand(10, 10, 10);
ifftpsi = ifftn(psi);
[m, n, p] = size(psi);
for k = 1:p
psi(:,:,k) = ifftn(psi(:,:,k));
end
psi = reshape(psi, [m*n p]);
for i = 1:m*n
psi(i,:) = ifft(psi(i,:));
end
psi = reshape(psi, [m n p]);
This code applies the inverse Fourier transform to each slice of “fftpsi” along the third dimension.
You can also refer to the below documentation link if required,
Hope this Helps!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!