Reputation: 2327
Could someone kindly explain what the following MATLAB
line do?
fft( data3D, N, dim );
data3D
is an array of size (NY, NX, NZ)
. MATLAB
documentation says
fft(X,[],DIM)
orfft(X,N,DIM)
applies thefft
operation across the dimensionDIM
.
What exactly fft
calculates across a dimension when the input is a 3D
array?
Upvotes: 0
Views: 526
Reputation: 1675
To expand on @Oliver Charlesworth, the command fft(X,[],DIM)
should do this:
fft_values=zeros(size(X)); %pre-allocate the output array
if (DIM==1)
for I=1:size(X,2)
for J=1:size(X,3)
fft_values(:,I,J) = fft(squeeze(X(:,I,J));
end
end
elseif (DIM==2)
for I=1:size(X,1)
for J=1:size(X,3)
fft_values(I,:,J) = fft(squeeze(X(I,:,J));
end
end
elseif (DIM==3)
for I=1:size(X,1)
for J=1:size(X,2)
fft_values(I,J,:) = fft(squeeze(X(I,J,:));
end
end
end
Upvotes: 2