
Subscript indices must either be real positive integers or logicals
Posted:
Aug 11, 2014 5:08 PM


When I run the program it shows me the message: Subscript indices must either be real positive integers or logicals I changed the values but it still doesn't work __________ clear all clc hGen = comm.CRCGenerator([1 0 0 1]); % compute CRC hDetect = comm.CRCDetector([1 0 0 1]); %compute CRC received
z=0; c=0; PFA=zeros(length(PFA),1)
w=0; d=0; PMD=0;
for p=0:0.05:1 for i=1:1e3
x = randi([0 1],1,12)'; % add random data X = step(hGen, x); % data + CRC transmitted
% Passes the binary input signal data through a binary symmetric channel with error probability p.
Y = bsc(X, p);
[xx,yy]=step(hDetect,Y); % transmission with errors
% False alarm if yy==1 %Even if there are any errors, it keeps running z=z+1; end
if xx==x & yy==1 % But if, while running showing errors, it shows that c=c+1; % received and transmitted data are the same, when in fact PFA=c/z; % they are not, it should calculate the False alarm probability. end
% Missed detection if yy==0 w=w+1; end
if xx~=x & yy==0 d=d+1; PMD=d/w; end end
z; c; PFA(p)=PFA w; d; PMD
end

