Error using vitdec For hard decision type, CODE must contain only binary values.

% 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
Walter Roberson am 16 Dez. 2022
vitdec -- "Convolutionally decode binary data by using Viterbi algorithm"
But your data is not 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?"

Tags

Gefragt:

am 16 Dez. 2022

Beantwortet:

am 16 Dez. 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by