How to parallelize this code or make it more efficient
24 ビュー (過去 30 日間)
古いコメントを表示
I'm doing 3D fft and I would like to parallelize this code if possible, or at least make it more efficient.
Dim=size(y);
N1_FFT=2*2^nextpow2(Dim(1));
N2_FFT=2*2^nextpow2(Dim(2));
N3_FFT=2*2^nextpow2(Dim(3));
N_FFT=[N1_FFT,N2_FFT,N3_FFT];
%Calculate 3D fft
CostFunction3=y;
for p = 1:length(size(y))
CostFunction3 = fft(CostFunction3,N_FFT(p),p);
end
CostFunction3 = fftshift(abs(CostFunction3).^2);
Edit: forgot to mention, y is a 3D matrix with signal samples
2 件のコメント
Adam
2017 年 2 月 8 日
If y is a vector how is this a 3D FFT?
Also you should use
ndims(y)
if you want to loop over the number of dimensions, which is what length( size(y) ) will give you, but in your case, if y is a vector this will return 2 which is not helpful really anyway because one of those dimensions will be a singleton.
回答 (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!