我需要在字母 {0,1,2,3} 上构建一个对称通道,类似于 Matlab 的二进制对称通道。我需要传输错误的概率为 p/3,成功传输的概率为 (1-p) 为 0
我找不到满足我要求的 Matlab 函数,我希望有人知道如何手动设置它?
任何帮助表示赞赏。
我需要在字母 {0,1,2,3} 上构建一个对称通道,类似于 Matlab 的二进制对称通道。我需要传输错误的概率为 p/3,成功传输的概率为 (1-p) 为 0
我找不到满足我要求的 Matlab 函数,我希望有人知道如何手动设置它?
任何帮助表示赞赏。
我认为这可以满足您的要求:
%// Data
transmitted = [ 0 3 2 1 3 2 ]; %// sequence of transmitted symbols. Example data
M = 4; %// alphabet size
p = .3; %// symbol error probability
%// Generate received sequeence
n = numel(transmitted); %// sequence size
received = transmitted; %// no errors for for now
ind = rand(1,n)<=p; %// index of symbols with error
changes = randi(M-1,1,nnz(ind)); %// changes to be applied for symbols with error
received(ind) = mod(received(ind)+changes,M); %// apply changes