```Path: news.mathworks.com!not-for-mail
From: "ghasem " <shaban_sadeghi@yahoo.com>
Newsgroups: comp.soft-sys.matlab
Subject: how use from fft in three dimensional domain
Date: Thu, 25 Apr 2013 12:44:10 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 27
Message-ID: <klb8eq\$lp1\$1@newscl01ah.mathworks.com>
NNTP-Posting-Host: www-06-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1366893850 22305 172.30.248.38 (25 Apr 2013 12:44:10 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 25 Apr 2013 12:44:10 +0000 (UTC)
Xref: news.mathworks.com comp.soft-sys.matlab:794327

Hi.
I have several 4 dimensional arrays in space-time domain (named as : aux_a,aux_b,...).
in each of them,forth dimension is time and three other dimensions are spatial coordinates.
I want to calculate their DFT for a given frequency interval .but I don't know how implement fftn or faster method in this case.
I wrote following code:
======================
n = 10000;  % number of time steps.
dt = 5e-3;    % sampling time interval
freq = (50:5:300);    % desired frequency interval
% aux_a,b are a predetermined 4d arrays in space-time domain
% [ you suppose aux_a,b,... =rand(3,4,5,n) ,...]
a = zeros(3,4,5,length(freq));
b = zeros(3,4,5,length(freq));
for m = 1:n
for k = 1:length(freq)
exp_h = exp(-1j * freq( k )* m * dt);
a(:,:,:,f) = a(:,:,:,f) + exp_h * aux_a(:,:,:,m);
b(:,:,:,f) = b(:,:,:,f) + exp_h * aux_b(:,:,:,m);
...
end
end
======================
now suppose I have 22 other 4 dimensional arrays like as b and c in above.and I have to calculate their fourier transform like as above.
this code is very slow.I want to use from fftn or a better method.
but I don't know how implement fftn for this problem.
is there anyone who help me?
thanks...
```