Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


Math Forum » Discussions » Software » comp.soft-sys.matlab

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   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
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.