Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Subscript indices must either be real positive integers or logicals
Replies: 6   Last Post: Aug 13, 2014 6:43 PM

 Messages: [ Previous | Next ]
 Vinicius Posts: 7 Registered: 7/17/14
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

Date Subject Author
8/11/14 Vinicius
8/11/14 Andrew
8/11/14 dpb
8/11/14 dpb
8/12/14 dpb
8/13/14 Vinicius
8/13/14 dpb