Index exceeding array during data transmission
1 次查看(过去 30 天)
显示 更早的评论
Hello,
I'm transmitting data through channel which is simulated in matlab. The data goes through source and channel coding. The problem is that when I'm reconstructing the vector elements to array, I'm exceeding the number of elements with array. I've attached dict.mat which contains all the variables that are already encoded through source coding and the dictionary.
The following code is then executed where the error is occurring at the last loop. Any feedback would be appreciated.
clc;
close all;
clear all;
load dict
m = 8;
n = 2^m-1;
k = 245;
t = floor((n-k)/2);
I = gf(double(hcode),m);
ImLength=length(hcode);
% channel encoding
c = rsEncoder(I);
code = c.x;
code = double(code);
% Simulate a transmission over a channel
p = 1-(1-0.001)^8;
e = rand(1,ImLength) <= p;
error_pos = find(e);
e = double(e);
% Add errors to encoded signal
Ir2=gf(code,m)+gf(e,m);
% channel decoding
d = rsDecoder(Ir2,ImLength);
decoded = d.x;
decoded=double(decoded);
%Source decoding
dhsig = uint8(huffmandeco(decoded,dict));
%variables using to convert vector 2 array
arr_row = 1;
arr_col = 1;
vec_si = 1;
for x = 1:m
for y = 1:n
back(x,y)=dhsig(vec_si);
arr_col = arr_col+1;
vec_si = vec_si + 1;
end
arr_row = arr_row+1;
end
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Error Detection and Correction 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!