HE/JudgeTypeJam.m
2024-03-30 16:35:40 +08:00

71 lines
2.0 KiB
Matlab
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

%%************************【判断干扰类型函数】****************************%%
%%=============================参数说明===================================%%
% J: 检测出来的干扰点集合
%Type: 干扰类型
%%========================================================================%%
function Type = JudgeTypeJam(J)
J = sort(J,'ascend');
len_J = length(J);
c1 = 1;
band = cell(0,0);
mono_d = cell(0,0);
mono = [];
if len_J == 0
Type = 'No jam';
elseif len_J <= 3 %&& len_J > 0 %% 检测点数小于3判断是离散还是连续单音或者多音
if len_J == 1
Type = 'mono';
else
if len_J == 2
if J(2)-J(1) == 1
Type = 'mono';
else
Type = 'multi';
end
else
if J(3) - J(1) == 2
Type = 'mono';
else
Type = 'multi';
end
end
end
else
while c1 < len_J
c2 = 0;
while (c1 + c2 + 1 <= len_J && J(c1) + c2 + 1== J(c1 + c2 + 1))
c2 = c2 + 1;
end
if(c2 > 2)
band = [band;(J(c1:1:c1+c2))]; %% 连续点超过3记为频带干扰
end
if (c2 == 2 || c2 == 1)
mono_d = [mono_d;(J(c1:1:c1+c2))]; %% 频谱扩散的单音
end
if c2 == 0
mono = [mono,J(c1)];
end
c1 = c1 + c2 +1;
if c1 == len_J && J(len_J-1) + 1 ~= J(len_J)
mono = [mono,J(len_J)];
end
end
num_band = numel(band);
num_mono_d = numel(mono_d);
num_mono = length(mono);
num_multi = num_mono + num_mono_d;
if num_band ~= 0
if num_multi == 0
Type = 'band';
else
if num_multi >1
Type = 'band_multi';
else
Type = 'band_mono';
end
end
else
Type = 'multi';
end
end
%% end