필터 지우기
필터 지우기

Index exceeding array during data transmission

조회 수: 1 (최근 30일)
Ayesha
Ayesha 2014년 6월 7일
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개)

카테고리

Help CenterFile Exchange에서 Numeric Types에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by