could anyboby help me to solve the error

8 views (last 30 days)
Bmax=20;
noise=10;
E = [2 3 0 0 5;
5 6 0 0 4;
1 9 0 0 3]
P = [1 5 0 0 6;
4 3 0 0 2;
7 8 0 0 9]
U=sort(E,'descend')
V=sort(P)
throughput =(Bmax.*log2(1+((V(i).*U(i))./(noise+(sum(U,1,i-1).*V(i))))))
If i run the code i am getting Error in
throughput=(Bmax.*log2(1+((V(i).*U(i))./(noise+(sum(U,1,i-1).*V(i))))))
Subscript indices must either be real positive integers or logicals.
Could anyone help me to solve the error.
  2 Comments
Adam
Adam on 15 Jan 2018
i is not defined anywhere in the code you gave us so could be anything.
This error is easy to locate though if you just use the stop/pause on errors option from the breakpoints menu in the editor and use the command line to investigate your variables when it stops. You will find that one of your indices into an array on that line is not a real positive integer or a logical.
The most obvious candidates for the error would seem to be that i is 0 or negative or floating point or that you have created a variable somewhere called 'sum' that it is trying to index into using U, which clearly contains 0s
Prabha Kumaresan
Prabha Kumaresan on 15 Jan 2018
sorry its my mistake where i indicates the number present in U and V matrix.could you please help me how to define i in the code in such a way i value needs to implemented in the throughput equation.

Sign in to comment.

Accepted Answer

Greg Heath
Greg Heath on 15 Jan 2018
i is undefined
However if i were defined U(i) would probably be incorrect because U is 2 dimensional.
You probably have to define a for loop over i
Hope this helps.
Thank you for formally accepting my answer
Greg

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!