Question

I need to construct a symmetric channel over the alphabet {0,1,2,3} similar to Matlab's Binary Symmetric Channel. I need the probability of transmission error to be p/3 and the probability of successful transmission to be (1-p) for 0

I have not been able to find a Matlab function that meets my requirements and I was hoping somebody would know how to go about setting this up manually?

Any help appreciated.

Was it helpful?

Solution

I think this does what you want:

%// 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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top