47 lines
1.6 KiB
Matlab
47 lines
1.6 KiB
Matlab
function showErrorBurstCount(eq_signal,ref_symbols,options)
|
|
arguments
|
|
eq_signal
|
|
ref_symbols
|
|
options.fignum (1,1) double = NaN % Default to NaN if not provided
|
|
options.displayname (1,:) char = '' % Default to an empty string if not provided
|
|
end
|
|
|
|
% Determine the figure number to use or create a new figure
|
|
if isnan(options.fignum)
|
|
fig = figure; % Create a new figure and get its handle
|
|
else
|
|
fig = figure(options.fignum); % Use the specified figure number
|
|
end
|
|
|
|
if numel(unique(eq_signal.signal)) > 20
|
|
M = numel(unique(ref_symbols.signal));
|
|
eq_signal = PAMmapper(M,0).quantize(eq_signal);
|
|
end
|
|
|
|
diff_indices = eq_signal.signal == ref_symbols.signal;
|
|
|
|
|
|
% Identify the start of new sequences (when the difference is not 1)
|
|
sequence_starts = [1, find(diff_indices ~= 1) + 1]; % Include the first index
|
|
sequence_ends = [sequence_starts(2:end) - 1, length(errpos)]; % Calculate end indices
|
|
|
|
% Initialize burst count and print bursts longer than 10
|
|
burst_len = 1:10;
|
|
burst_count = zeros(length(burst_len),1);
|
|
for t = 1:numel(burst_len)
|
|
for i = 1:length(sequence_starts)
|
|
% Extract current sequence
|
|
current_burst = errpos(sequence_starts(i):sequence_ends(i));
|
|
% Check if the sequence length matches criterion
|
|
if length(current_burst) == burst_len(t)
|
|
burst_count(t) = burst_count(t) + 1;
|
|
end
|
|
end
|
|
end
|
|
|
|
burst_symbols = burst_count .* burst_len';
|
|
burst_rate = burst_symbols ;%./ length(rx_signal);
|
|
|
|
|
|
|
|
end |