Help Please! I'm plotting curve for (7,4) hamming code.
Afficher commentaires plus anciens
I'm doing (7,4) hamming code can anybody tell me where I'm doing mistake for that I'm unable to get plot for this code? And how can I do convolutional performance in this code?
close all, clc, clear all;
num_bits = 8;
p = 0:0.0001:0.1
for a = 1:length(p);
genmat = hammgen(3)
n = 7; % Codeword length
k = 4; % Message length
data = randi([0 1],1,num_bits) % Random matrix
encData = encode(data,n,k,'hamming/binary')
nz = bsc(data,p(a))
data(4) = ~data(4)
decData = decode(encData,n,k,'hamming/binary')
numerrs(:,1) = biterr(data,decData)
ber = numerrs/num_bits
end
plot(p,ber,'g--o')
xlim([0 0.1])
ylim([0.0001 1])
legend('hamming (7,4)')
xlabel('p crossover probability for the bsc')
ylabel('Probability of error')
title('19TL49')
grid on
Réponses (1)
Torsten
le 19 Nov 2022
ber(a) = numerrs/num_bits;
instead of
ber = numerrs/num_bits;
Catégories
En savoir plus sur PHY Components dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!