1. SNR 신호처리, Secondary surface 영향 고려하여 SNR 재계산

2. Coverage Figure 개선
3. 윈도우 생성 및 성능 계산 함수 추가
This commit is contained in:
2026-03-06 06:48:07 +09:00
parent e002d08580
commit 3c05d2be09
5 changed files with 270 additions and 123 deletions
@@ -0,0 +1,118 @@
function [windowVector, metrics] = create_window_with_metrics(windowType, windowLength, varargin)
% CREATE_WINDOW_WITH_METRICS -
%
% :
% windowType - : 'none', 'hann', 'hamming', 'blackman', 'chebwin'
% windowLength - ( )
% varargin - (: chebwin의 sidelobe level)
%
% :
% windowVector - (1 x windowLength)
% metrics -
% .type :
% .length :
% .snr_loss_dB : SNR (dB)
% .scalloping_loss_dB: Scalloping (dB)
% .coherent_gain :
% .enbw : Equivalent Noise Bandwidth (bins)
%
if windowLength <= 0
error('Window length must be positive.');
end
%
switch lower(windowType)
case 'none'
windowVector = ones(1, windowLength);
case 'hann'
windowVector = hann(windowLength)';
case 'hamming'
windowVector = hamming(windowLength)';
case 'blackman'
windowVector = blackman(windowLength)';
case 'chebwin'
% Chebyshev sidelobe level (: 60dB)
if ~isempty(varargin)
sidelobe_dB = varargin{1};
else
sidelobe_dB = 60;
end
windowVector = chebwin(windowLength, sidelobe_dB)';
otherwise
warning('Unknown window type "%s". Using Hann window as default.', windowType);
windowVector = hann(windowLength)';
windowType = 'hann';
end
%
metrics = calculate_window_metrics(windowVector, windowType);
end
function metrics = calculate_window_metrics(windowVector, windowType)
% CALCULATE_WINDOW_METRICS -
%
% :
% 1. SNR Loss (dB) : SNR
% 2. Scalloping Loss (dB): FFT bin (0.5 bin offset)
% 3. Coherent Gain :
% 4. ENBW (bins) : Equivalent Noise Bandwidth
w = windowVector(:).'; % Row vector로
N = numel(w);
if N == 0
metrics = struct('type', windowType, 'length', 0, ...
'snr_loss_dB', NaN, 'scalloping_loss_dB', NaN, ...
'coherent_gain', NaN, 'enbw', NaN);
return;
end
% 1. Coherent Gain ( )
coherent_gain = mean(w);
% 2. Noise Power Gain ( )
noise_power_gain = mean(abs(w).^2);
% 3. SNR Loss (dB)
% SNR_loss = (Noise Power Gain) / (Coherent Gain)^2
%
if abs(coherent_gain) > eps
snr_loss_linear = noise_power_gain / (abs(coherent_gain)^2);
snr_loss_dB = 10 * log10(snr_loss_linear);
else
snr_loss_dB = NaN;
end
% 4. Equivalent Noise Bandwidth (ENBW)
% ENBW는 bin의
enbw = N * noise_power_gain / (sum(w)^2);
% 5. Scalloping Loss (dB)
% FFT bin (0.5 bin offset)
%
sample_index = 0:(N-1);
half_bin_response = abs(sum(w .* exp(-1j * 2 * pi * 0.5 * sample_index / N)));
dc_response = abs(sum(w));
if dc_response > eps
scalloping_loss_dB = -20 * log10(half_bin_response / dc_response);
else
scalloping_loss_dB = NaN;
end
%
metrics = struct(...
'type', lower(windowType), ...
'length', N, ...
'snr_loss_dB', snr_loss_dB, ...
'scalloping_loss_dB', scalloping_loss_dB, ...
'coherent_gain', coherent_gain, ...
'enbw', enbw);
end