Error using vitdec For hard decision type, CODE must contain only binary values.
Ältere Kommentare anzeigen
% Define the convolutional code parameters
% These values correspond to a (7,5) convolutional code
% with rate 1/2 and polynomial generators [133, 171]
trellis = poly2trellis(7, [133, 171]);
% Set the input data
data = randi([0, 1], 1, 50);
% Perform convolutional encoding
encoded_data = convenc(data, trellis);
% Add noise to the encoded data
received_data = encoded_data + randn(1, length(encoded_data));
% Perform Viterbi decoding
decoded_data = vitdec(received_data, trellis, 50, 'trunc', 'hard');
% Compare the original data to the decoded data
isequal(data, decoded_data)
Antworten (1)
Walter Roberson
am 16 Dez. 2022
0 Stimmen
vitdec -- "Convolutionally decode binary data by using Viterbi algorithm"
But your data is not binary.
See https://www.mathworks.com/matlabcentral/answers/43990-how-to-match-simulation-result-with-theoritical-result-by-adding-noise-to-convolutional-encoding-wit for an example of a user who used quantization to convert to binary.
Note that randn() could theoretically return indefinitely large or indefinitely negative values: randn() has infinite tails in both directions.
If It were me doing the assignment, I would be asking, "Suppose you start with a value that is 0 or 1, and you add normally distributed random noise to it with mean 0 and standard deviation 1, then given the resulting number, what is the probability that the original number was 0, and what is the probability that the original number was 1? From the relatively probabilities, how do you calculate which of the two the value is more likely to have been?"
Kategorien
Mehr zu Error Detection and Correction finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!