% DataV is the single sweep time/spatial samples arranged in a [N_antennas x N_samples] matrix
% the others parameters are about the FFT order, the scale factor the calibration matrix to correct the phase shifts (due to rf circuitry, etc)
% I tried a lot of windowing options to reduce the sidelobes (here i'm using a hanning win)
% Calculate range profile including calibration
RP = fft(DataV.*Win2D.*mCalData,NFFT,1).*Brd.FuSca/ScaWin;
RPExt = RP(RMinIdx:RMaxIdx,:);
% calculate fourier transform over receive channels
JOpt = fftshift(fft(RPExt.*WinAnt2D,NFFTAnt,2)/ScaWinAnt,2);
% normalize cost function
JdB = 20.*log10(abs(JOpt));
JMax = max(JdB(:));
JNorm = JdB - JMax;