FFT function error with higher size of data

조회 수: 21 (최근 30일)
Mani
Mani 2023년 12월 19일
편집: Walter Roberson 2023년 12월 20일
I want to do 2D FFT for 1100x 32x 16384 and 1100x 32x36864 size of data.
i have added sample code here .I could able to do FFT upto 1100x32x4096 data.If try for 1100x 32x 16384 data matlab throws error "Requested 2048x32x16384 (16.0GB) array exceeds maximum array size preference. Creation of arrays greater than this limit
may take a long time and cause MATLAB to become unresponsive."
How to do FFT for higher size of data without any error?
%%%%%%%%%%My matlab code used for 2D FFT %%%%%%%%%%%%%%%%
Nrow= 128;
Ncol=128;
input_data = rand(1100,32,Nrow*Ncol);
Nr = size(input_data,1);
Nd = size(input_data,2);
Nant = size(input_data,3);
rng_window = hann(Nr);
dop_window = hann(Nd)';
range_NFFT = 2^nextpow2(Nr);
doppler_NFFT = 2^nextpow2(Nd);
rng_fft_input = input_data .* rng_window;
Xrng_fft_output = fft(rng_fft_input,range_NFFT);
dop_fft_input = Xrng_fft_output .* dop_window;
yout_1 =fft(dop_fft_input,doppler_NFFT,2);
yout_2= fftshift(yout_1,2);
Xrngdop_output= fftshift(yout_2,1);
%%%%%%%%%%My matlab code used for 2D FFT %%%%%%%%%%%%%%%%
  댓글 수: 3
Mani
Mani 2023년 12월 20일
at the following line::
Xrng_fft_output = fft(rng_fft_input,range_NFFT);
Mani
Mani 2023년 12월 20일
Error using fft
Requested 2048x32x16384 (16.0GB) array exceeds maximum array size preference. Creation of arrays greater than this limit
may take a long time and cause MATLAB to become unresponsive.
Error in fft_192_192_test (line 24)
Xrng_fft_output = fft(rng_fft_input,range_NFFT);

댓글을 달려면 로그인하십시오.

답변 (2개)

atharva
atharva 2023년 12월 19일
Hey Mani,
I understand that you face the error "Requested 2048x32x16384 (16.0GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause MATLAB to become unresponsive." when trying to do 2-D fast Fourier transformation.
To perform the 2D FFT for larger data sizes without encountering the "exceeds maximum array size preference" error, you can use the fft2 function instead of performing separate 1D FFTs along the rows and columns.
The fft2 function is used to compute the two-dimensional discrete Fourier transform (DFT) of an image or a matrix. It takes a two-dimensional input signal and returns its frequency domain representation.
You can go through the official MathWorks documentation for a better understanding
I hope this helps!
  댓글 수: 1
Mani
Mani 2023년 12월 20일
getting same error with fft2 also
Error using fft
Requested 2048x32x16384 (16.0GB) array exceeds maximum array size preference. Creation of arrays greater than this limit
may take a long time and cause MATLAB to become unresponsive.
Error in fft2 (line 26)
f = fft(fft(x,ncols,2),mrows,1);
Error in fft_192_192_test (line 32)
Xrngdop_output_2=fft2(input_data,range_NFFT,doppler_NFFT);

댓글을 달려면 로그인하십시오.


Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023년 12월 19일
In your exercise, fftn() would be faster and more efficient to run simulations - see DOC.
However, in order to estimate which FFT is the most suitable for your data, use this builtin function fftw() - see DOC
  댓글 수: 2
Mani
Mani 2023년 12월 20일
편집: Walter Roberson 2023년 12월 20일
i have tried different fft optimisation method using fftw() but still getting same error:
%%%%%%%% MATLAB code%%%%%%%%%%%%%%%%%%%
clc;
close all;
clear all;
fftw('planner','measure');
method = fftw('planner')
% Nrow= 4;
% Ncol=4;
Nrow= 128;
Ncol=128;
input_data = rand(1100,32,Nrow*Ncol);
Nr = size(input_data,1);
Nd = size(input_data,2);
Nant = size(input_data,3);
rng_window = hann(Nr);
dop_window = hann(Nd)';
range_NFFT = 2^nextpow2(Nr);
doppler_NFFT = 2^nextpow2(Nd);
% rng_fft_input = input_data ;
rng_fft_input = input_data .* rng_window;
tic
Xrng_fft_output = fft(rng_fft_input,range_NFFT);
% dop_fft_input = Xrng_fft_output;
dop_fft_input = Xrng_fft_output .* dop_window;
yout_1 =fft(dop_fft_input,doppler_NFFT,2);
toc
yout_2= fftshift(yout_1,2);
Xrngdop_output= fftshift(yout_2,1);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
method =
'measure'
Error using fft
Requested 2048x32x16384 (16.0GB) array exceeds maximum array size preference. Creation of arrays greater than this limit
may take a long time and cause MATLAB to become unresponsive.
Error in fft_192_192_test (line 28)
Xrng_fft_output = fft(rng_fft_input,range_NFFT);
Mani
Mani 2023년 12월 20일
for your info:fftn is useful if we are taking fft on individual dimension of input data.
My requirement is 2D fft(where 2nd FFT will be taken across the column of first FFT output data and first FFT is nothing but FFT taken across row of input_data).so i cannot use fftn().

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Fourier Analysis and Filtering에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by