필터 지우기
필터 지우기

Index exceeds the number of array elements Index must not exceed 634 error digital signal processing

조회 수: 1 (최근 30일)
Im trying alot and I couldn't find the bug in my code its been exhausting for me, Therefore I want to ask if there anyone could help in this matter
This is my code:
clc
clear all
load config.mat
data = load('RefInputAudio.mat');
ChannelOutVec = data.ChannelOutVec';
rx = RX(config,ChannelOutVec);
bitstream2text(rx)
the output on running this at the reciever RX function should be "digital communication is fun!"
I have attached all the necessary files that im working on them.

답변 (1개)

Saarthak Gupta
Saarthak Gupta 2023년 11월 29일
Hi Audai,
I understand you are getting an out-of-bounds error in your program.
Elementary debugging revealed that the out-of-bounds error is thrown while trying to index the ‘rxbits’ array in the ‘RX’ function (RX.m).
The error occurs due to faulty downsampling of the ‘rxbits’ signal. ‘rxbits’ is a 1x253243 signal, which is downsampled by a factor of 440 (config.Ts-1), yielding a 1x576 signal. While converting the (downsampled) ‘rxbits’ to a binary signal, the code tries to access its first 10000 elements, which is erroneous since ‘rxbits’ is a 1x576 signal, as stated above.
You may want to recheck the downsampling factor of the signal, or you can access only the valid elements of ‘rxbits’. Refer to the following snippet:
rxbits = sign(rxbits(1:min(numel(rxbits),config.ninfobits)));
Please refer to the following MATLAB documentation for further reference:

카테고리

Help CenterFile Exchange에서 Signal Operations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by