i got this error at symbol ofdm "Index exceeds matrix dimensions." from list program for make a pilot and guard ofdm symbol. the list program like this:
% making odfm symbol and taking IFFT
% function symbol_ofdm = createsymbol (pilots,data)
%now first generate the pilot
A=complex(-1,0);
B=complex(1,0);
pilots = [A B A B B B A A]; %%% here we direct making the pilot,detail procedure given below
% n_symbol = 1; % At the time of generating the pilots, I need to know what symbol i am simulating
% because the seed to do it depends on it.
% The values of the pilots are to be modulated are defined in the standard as such(pp 443) :
% Before beginning, it is necessary to consider that the value to calculate depends on 2 factors :
% the number of symbols and whether we are in the uplink or dwnlink. We will consider that we are in
% the downlink and we are transmitting the symbol "1".
% If we want to consider the other uplink connection, the seed would be "10101010101".
% seed = [1 1 1 1 1 1 1 1 1 1 1];
% for i=1:n_symbol+2
% wk(i) = seed (11);
% next = xor(seed(9),seed(11));
% seed = [next seed(1,1:10)];
% end
% Once the value of wk is found(that depends on the number of symbol with wihich it is working),
% the values of the subcarriers must be found and of the mapping of them with BPSK constellation.
% wk = wk(n_symbol+2)
% A = 1 - 2*wk % Values defined in the standard.
% B = 1 - 2*(~wk)
% value_carrier = [A B A B B B A A]
% For uplink, the values should be [A B A B A A A A]
% pilot_mapping = 2*mapping(value_carrier,1,Tx);
% The factor of "2" is due to the fact that the pilots are transmitted to a
% double power of the information bits.
% NOW The guard bands are prepared.
guard1 = complex (0,0) * ones (1,28);
DC = complex (0,0);
guard2 = complex (0,0) * ones (1,27);
% The pilot and guard subcarriers are placed according to the standard.
fx = [guard1 data(1:12) pilots(1) data(13:36) pilots(2)...
data(37:60) pilots(3) data(61:84) pilots(4) data(85:96) DC...
data(97:108) pilots(5) data(109:132) pilots(6) data(133:156)...
pilots(7) data(157:180) pilots(8) data(181:192) guard2];
% here the ofdm symbol is completed
%Now taking IFFT
symbol_ofdm = ifft(fx,Nfft);
%Now adding cyclic prefix
%we generate the cyclic prefix so that the multipaths do not affect our data so much.
margin = length(symbol_ofdm)*G;
data_tx = [symbol_ofdm((end-margin+1):end) symbol_ofdm];
data_transmitter=data_tx;
and then i got that problem. so how do i solve this error?
please help me.. i don't know what i do for solve that error. i finish browse at google and mathwork's help but i can't solve that problem.
can somebody help me and give advise for me? thank you before..
thank you.
No products are associated with this question.
5 Comments
Direct link to this comment:
http://www.mathworks.com/matlabcentral/answers/83746#comment_162472
set the debugger to stop on error and then you can investigate the values making up the index expression and the array. That will likely lead you to understanding where you made a logic error.
In future, start w/ pasting the actual error text from the command line and then just the relevant short section of code around it. Trying to pick out what might be a problem w/o the precise error/location and from a long piece of code is painful to the readers that you're asking to help you...anything you can do to make their job easier is going to help you.
OK, anyway, all the above boils down to...
fx = [guard1 data(1:12) pilots(1) data(13:36) pilots(2)... data(37:60) pilots(3) data(61:84) pilots(4) data(85:96) DC... data(97:108) pilots(5) data(109:132) pilots(6) data(133:156)... pilots(7) data(157:180) pilots(8) data(181:192) guard2];The first problem is "what is G"? It's undefined above; hence it's not possible to know what value margin has. I'd guess there's the problem.
Direct link to this comment:
http://www.mathworks.com/matlabcentral/answers/83746#comment_162481
that is coding clearer from error i got. the actually error at
% The pilot and guard subcarriers are placed according to the standard. fx = [guard1 data(1:12) pilots(1) data(13:36) pilots(2)... data(37:60) pilots(3) data(61:84) pilots(4) data(85:96) DC... data(97:108) pilots(5) data(109:132) pilots(6) data(133:156)... pilots(7) data(157:180) pilots(8) data(181:192) guard2];so how do i solve this error?
please help me.. i don't know what i do for solve that error. i finish browse at google and mathwork's help but i can't solve that problem.
can somebody help me and give advise for me? thank you before..
thank you.
Direct link to this comment:
http://www.mathworks.com/matlabcentral/answers/83746#comment_162532
You didn't answer the question...what's G and what is, therefore, margin value?
You also didn't actually show the error from the command window exactly w/ cut 'n paste...
Use the debugger...
doc debug
What you need to do is to figure out what the value of the indexing expressions are and compare them to the size() of the array. One of them (and one presumes it is (end-margin+1)) is >size() the array. That would tend to indicate margin is probably zero so the expression is end+1 which is would be greater than the length in that dimension.
Direct link to this comment:
http://www.mathworks.com/matlabcentral/answers/83746#comment_162536
What is size(pilots) and size(data) ?
Direct link to this comment:
http://www.mathworks.com/matlabcentral/answers/83746#comment_162541
Walt, assuming she showed us everything,
pilots is a complex vector length=8 --it's defined up top altho it's surely easy to miss in all the obfuscation of unneeded stuff...
You're right, she doesn't show a definition for data--I presumed it is 192 owing to the fact the error apparently doesn't show up until address the symbol_ofdm array.
Too bad she hasn't responded w/ any useful information only the repeated question. :(