Code covered by the BSD License  

Highlights from
Model of the channel with the packaged errors

Model of the channel with the packaged errors

by

 

The channel can be in two conditions: good and bad. good - no errors. bad - errors probable

bursterrorsstream (P, Q, E, N)
% Function of generation of a stream of the packaged errors
function [A] = bursterrorsstream (P, Q, E, N)
% P - Probability of a finding of the channel in a "good" condition
% Q - Probability of a finding of the channel in a "bad" condition
% E - Probability of occurrence of an error
% N - the Minimum size of a returned file
format long
A = zeros();
n = 0;
% While the returned file has not reached the demanded size
while n < N
    n = n + 1;
    b = rand(1);
    % While the channel is in a "good" condition
    while b < P
        % We write down in a file "0"
        A(n) = 0;
        n = n + 1;
        b = rand(1);
    end
    % When the channel has passed in a "bad" condition
    % And if there was an error
    b = rand(1);
    if b < E
        % We write down in a file "1"
        A(n) = 1;
    end
    b = rand(1);
    % While the channel is in a "bad" condition
    while b < Q
        n = n + 1;
        b = rand(1);
        % And if there was an error
        if b < E
            % We write down in a file "1"
            A(n) = 1;
        end
        b = rand(1);
    end
    % When the channel has passed in a "good" condition
    % We write down in a file "0"
    n = n + 1;
    A(n) = 0;
end
end

        
        

Contact us