Ordnerstruktur

This commit is contained in:
Silas Oettinghaus
2026-04-23 16:16:58 +02:00
parent 8fd68c0a54
commit 456fd02186
13 changed files with 1117 additions and 194 deletions

View File

@@ -4,6 +4,7 @@ arguments
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
options.max_burst_length (1,1) double = 20
end
% Determine the figure number to use or create a new figure
@@ -18,30 +19,17 @@ end
eq_signal = PAMmapper(M,0).quantize(eq_signal);
end
diff_indices = eq_signal.signal == ref_symbols.signal;
errpos = find(eq_signal.signal(:) ~= ref_symbols.signal(:));
burst_len = 1:options.max_burst_length;
burst_count = count_error_bursts(errpos, options.max_burst_length);
% 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
bar(burst_len, burst_count, "DisplayName", options.displayname);
grid on;
xlabel("Error burst length");
ylabel("Count");
title("Error burst count");
if ~isempty(options.displayname)
legend("show");
end
burst_symbols = burst_count .* burst_len';
burst_rate = burst_symbols ;%./ length(rx_signal);
end
end

View File

@@ -3,10 +3,14 @@ function burst_count = count_error_bursts(err_pos, max_burst_length)
% max_burst_length: Maximum length for which bursts are counted (e.g., 10)
% Sort the error positions to ensure they're in increasing order
err_pos = sort(err_pos);
err_pos = sort(err_pos(:).');
% Initialize burst_count array to hold the counts for each burst length
burst_count = zeros(1, max_burst_length);
if isempty(err_pos)
return
end
% Find the differences between consecutive error positions
diffs = diff(err_pos);