Index exceeding array during data transmission
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Error Detection and Correction dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!