필터 지우기
필터 지우기

error: Array indices must be positive integers or logic

조회 수: 2 (최근 30일)
Kayla Garcia
Kayla Garcia 2024년 2월 2일
댓글: Walter Roberson 2024년 2월 2일
please help

답변 (2개)

VBBV
VBBV 2024년 2월 2일
y(i) = y(i) + 1;
instead of
y(II) = y(II) + 1;
  댓글 수: 2
VBBV
VBBV 2024년 2월 2일
편집: VBBV 2024년 2월 2일
The value of II may be a floatpoint number. MATLAB uses integer and 1 based indexing for accessing array elements
Kayla Garcia
Kayla Garcia 2024년 2월 2일
thank you for the response. i have changed it and it is still giving me the same error message.

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


Walter Roberson
Walter Roberson 2024년 2월 2일
Due to floating point round-off, the result A+(B*x(i)) might not be exactly an integer. You should round() it.
  댓글 수: 2
Kayla Garcia
Kayla Garcia 2024년 2월 2일
when i try round() i recieve a different message
Walter Roberson
Walter Roberson 2024년 2월 2일
You have not posted enough context to really give you an answer.
But I suspect that you should have made x one element shorter. Something along the line of
x = linspace(xmin, xmax, number_of_steps+1);
x = x(1:end-1);

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

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by