Help Please! I'm plotting curve for (7,4) hamming code.
显示 更早的评论
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
回答(1 个)
Torsten
2022-11-19
ber(a) = numerrs/num_bits;
instead of
ber = numerrs/num_bits;
类别
在 帮助中心 和 File Exchange 中查找有关 Axis Labels 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!