How to replace fftn and ifftn with parallel statements
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Sanju
le 15 Fév 2024
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 commentaires
Voir également
Catégories
En savoir plus sur Fourier Analysis and Filtering dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!