FFT function error with higher size of data

24 visualizaciones (últimos 30 días)
Mani
Mani el 19 de Dic. de 2023
Editada: Walter Roberson el 20 de Dic. de 2023
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 comentarios
Mani
Mani el 20 de Dic. de 2023
at the following line::
Xrng_fft_output = fft(rng_fft_input,range_NFFT);
Mani
Mani el 20 de Dic. de 2023
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);

Iniciar sesión para comentar.

Respuestas (2)

atharva
atharva el 19 de Dic. de 2023
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 comentario
Mani
Mani el 20 de Dic. de 2023
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);

Iniciar sesión para comentar.


Sulaymon Eshkabilov
Sulaymon Eshkabilov el 19 de Dic. de 2023
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 comentarios
Mani
Mani el 20 de Dic. de 2023
Editada: Walter Roberson el 20 de Dic. de 2023
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 el 20 de Dic. de 2023
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().

Iniciar sesión para comentar.

Categorías

Más información sobre Fourier Analysis and Filtering en Help Center y File Exchange.

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by