Info

This question is closed. Reopen it to edit or answer.

How to correct index exceeds matrix dimensions error.

1 view (last 30 days)
sajeena
sajeena on 18 Mar 2013
Closed: MATLAB Answer Bot on 20 Aug 2021
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

Answers (1)

Walter Roberson
Walter Roberson on 18 Mar 2013
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.

Community Treasure Hunt

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

Start Hunting!