How to correct index exceeds matrix dimensions error.

This is my codings. HEre it is showing error in the line data = symbols(x:x+3599); that is index exceeds matrix dimensions. Plz help me to clear this error.
clc;
clear all;
close all;
format long;
% GENERATION OF INFORMATION AND LDPC ENCODING
message= randint(1,43200); % INFORMATION BITS
H = dvbs2ldpc(2/3);
l = fec.ldpcenc(H);
codeword = encode(l,message);
figure;
stem(codeword(1:100));
xlabel('Samples');
ylabel('Amplitude');
title('LDPC encoding');
inter = randintrlv(codeword,64800);
figure;
stem(inter(1:100));
xlabel('Samples');
ylabel('Amplitude');
title('Interleaving');
hMod = modem.qammod('M', 256);
symbols = hMod.Constellation;
scatterplot(symbols);
% moutp = step(hMod, inter);
% mout = (moutp).';
symbols=symbols(:);
x = 1;
size(symbols);
for sym = 1:3 % SYMBOL LOOP
data = symbols(x:x+3599);
new_sym = zeros(1,3660);
for i = 1:3600
new_sym(i+30) = data(i);
end
p_sym = zeros(1,3780);
d = sort(randint(1, 40, [2 3650])); % random index for central pilot
for i = 1:39
if (d(i+1) - d(i)) < 5
d(i+1) = d(i+1) + 1;
end
end

답변 (1개)

Walter Roberson
Walter Roberson 2013년 3월 18일

0 개 추천

The size of hMod.Constellation is going to be the same as the number you passed in for the 'M' parameter -- that is, 256. But you try to access up to element #3600 of it the first time you use it.

이 질문은 마감되었습니다.

질문:

2013년 3월 18일

마감:

2021년 8월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by