필터 지우기
필터 지우기

could anyboby help me to solve the error

조회 수: 2 (최근 30일)
Prabha Kumaresan
Prabha Kumaresan 2018년 1월 15일
댓글: Prabha Kumaresan 2018년 1월 15일
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
Adam
Adam 2018년 1월 15일
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 2018년 1월 15일
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.

댓글을 달려면 로그인하십시오.

채택된 답변

Greg Heath
Greg Heath 2018년 1월 15일
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
  댓글 수: 1
Prabha Kumaresan
Prabha Kumaresan 2018년 1월 15일
could you please tell me how to define i in a for loop.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by