Why is this error occuring in my code.
조회 수: 9 (최근 30일)
이전 댓글 표시

Index exceeds matrix dimensions.
Error in test2 (line 20) C2(i) = B*log2(1+min(i));
댓글 수: 0
채택된 답변
KL
2017년 11월 2일
편집: KL
2017년 11월 2일
you're getting the error because you forgot to index B,
C2(i) = B(i)*log2(1+min(i))
But anyway, what do you even mean by min(i), i in your case is just a scalar.
I'd recommend you to rename the loop varible , i, to something else since i is the default imaginary unit in matlab. Nextly, pre-allocate A, B, C2 and d properly. For example,
A = zeros(1,length(ro_db))
TIP: when you see read underlines on your code, it means matlab is trying to help you by giving some warning and even recommendations, do not ignore them.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!