Reputation: 159
I have to transform an input column of 1024 complex value with 3D-fft in matlab. Dimensions are: Nx = 32 Ny = 16 Nz = 2.
What can I do?
Upvotes: 0
Views: 6071
Reputation: 104514
You have two options:
You can manually apply the FFT in each dimension separately. Luis Mendo pointed out that the FFT is a separate operation. You can use the fft
function to help you do that. Given that your signal is stored in A
, do something like this:
B = fft(fft(fft(A, [], 1), [], 2), [], 3);
Because the operation is separable, it doesn't matter which order you apply the fft
to. Here, I did it over the columns, then rows, then slices.
fftn
Alternatively, you can use fftn
which does the above for you under the hood. This is the N-Dimensional FFT and the documentation says that the equivalent code that fftn
performs under the hood is:
Y = X;
for p = 1:length(size(X))
Y = fft(Y,[],p);
end
Take note that the above code is essentially doing what Option #1 is doing, but we did this without any loops and nested called fft
three times.
Now, the above code assumes that your signal is stored in X
.... so:
Y = fftn(X);
.... is what you'd do.
Upvotes: 3