function [worst_scalloping_loss_dB, avg_scalloping_loss_dB, SNR_loss_dB] = cal_winloss(win) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Calculating losses of windowing % Start : 23.08.25 % End : 23.08.25 % developed by Kwanggoo Yeo % % Description % - Input % - 1) win [vector] : window function % % - Output % - 1) worst_scalloping_loss_dB [scalar], [dB] : scalloping loss in worst case % - 2) avg_scalloping_loss_dB [scalar], [dB] : scallopoing loss in average case [uniform distribution] % - 3) SNR_loss_dB [scalar], [dB] : SNR processing gain loss % % % History % (23.08.25) Completed % % Referece % - 1) Mark A. Richards, "Fundamentals of Radar Signal Processing 1st edition", p.257 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if size(win, 1) > 1 win = win.'; end N = length(win); worst_scalloping_loss_dB = mag2db( abs( sum( win .* exp(-1i * pi / N * [0:N-1]))) / sum(win)); SNR_loss_dB = pow2db( sum(win)^2 / (N * sum(win.^2)) ); findex = linspace(-pi/N, pi/N, 10000); for idx = 1 : length(findex) val(idx) = (abs( sum( win .* exp(-1i * findex(idx) * [0:N-1]))) / sum(win)); end avg_scalloping_loss_dB = mag2db(sum(val)/10000); end