lab_1 code is done, need to write pdf report
This commit is contained in:
File diff suppressed because it is too large
Load Diff
|
After Width: | Height: | Size: 248 KiB |
+4
-8
@@ -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_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;
|
||||
|
||||
for it = 1 : bits_array_len
|
||||
state_visit_counter = state_visit_counter + 1;
|
||||
current_bit = bits(it);
|
||||
|
||||
% two different rands for channel and bit logic
|
||||
@@ -35,13 +36,12 @@ for it = 1 : bits_array_len
|
||||
|
||||
% error and channel
|
||||
if channel_state == true
|
||||
state_visit_counter = state_visit_counter + 1;
|
||||
% channel selection from good state with probability p_gg
|
||||
if channel_change_probability < p_gg
|
||||
channel_state = 1;
|
||||
else
|
||||
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;
|
||||
end
|
||||
|
||||
@@ -52,11 +52,10 @@ for it = 1 : bits_array_len
|
||||
received_bit = current_bit;
|
||||
end
|
||||
else
|
||||
state_sequence(it) = 'Bad';
|
||||
% change channel to good with probability of p_bg
|
||||
if channel_change_probability < p_bg
|
||||
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;
|
||||
else
|
||||
channel_state = 0;
|
||||
@@ -93,6 +92,3 @@ title('Histogram of gap sizes between consecutive errors')
|
||||
|
||||
disp(state_sequence)
|
||||
disp(bit_error_rate)
|
||||
|
||||
% for pdf, 1 - 2 sites, describe what i did and what the results were and
|
||||
% are
|
||||
Reference in New Issue
Block a user