lab_1 code is done, need to write pdf report

This commit is contained in:
ti_mo
2026-04-23 23:43:49 +02:00
parent c92d3e3b09
commit 34ee636bd0
2 changed files with 3738 additions and 8 deletions
File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 248 KiB

+4 -8
View File
@@ -22,10 +22,11 @@ bit_error_rate_counter = 0;
gap_begin = 1; % stores the last dirty bit idx, meaning the begin of a new gap gap_begin = 1; % stores the last dirty bit idx, meaning the begin of a new gap
gap_tracker = []; % holds a 3xn matrix of begin and end gap values and the gap size between them gap_tracker = []; % holds a 3xn matrix of begin and end gap values and the gap size between them
state_sequence = []; % stores the state timeline state_sequence = strings(0); % stores the state timeline
state_visit_counter = 0; state_visit_counter = 0;
for it = 1 : bits_array_len for it = 1 : bits_array_len
state_visit_counter = state_visit_counter + 1;
current_bit = bits(it); current_bit = bits(it);
% two different rands for channel and bit logic % two different rands for channel and bit logic
@@ -35,13 +36,12 @@ for it = 1 : bits_array_len
% error and channel % error and channel
if channel_state == true if channel_state == true
state_visit_counter = state_visit_counter + 1;
% channel selection from good state with probability p_gg % channel selection from good state with probability p_gg
if channel_change_probability < p_gg if channel_change_probability < p_gg
channel_state = 1; channel_state = 1;
else else
channel_state = 0; channel_state = 0;
state_sequence(end + 1) = state_visit_counter + 'x Good'; state_sequence(end + 1) = string(state_visit_counter) + 'x Good';
state_visit_counter = 0; state_visit_counter = 0;
end end
@@ -52,11 +52,10 @@ for it = 1 : bits_array_len
received_bit = current_bit; received_bit = current_bit;
end end
else else
state_sequence(it) = 'Bad';
% change channel to good with probability of p_bg % change channel to good with probability of p_bg
if channel_change_probability < p_bg if channel_change_probability < p_bg
channel_state = 1; channel_state = 1;
state_sequence(end + 1) = state_visit_counter + 'x Bad'; state_sequence(end + 1) = string(state_visit_counter) + 'x Bad';
state_visit_counter = 0; state_visit_counter = 0;
else else
channel_state = 0; channel_state = 0;
@@ -93,6 +92,3 @@ title('Histogram of gap sizes between consecutive errors')
disp(state_sequence) disp(state_sequence)
disp(bit_error_rate) disp(bit_error_rate)
% for pdf, 1 - 2 sites, describe what i did and what the results were and
% are