Array indices must be positive integers or logical values.

Why do I get this error?
>> x=linspace(0,10,1000)';
>> y1(x)=cos(x).^2.*exp(-0.4.*x)
Array indices must be positive integers or logical values.

 채택된 답변

KSSV
KSSV 2020년 5월 8일
x = linspace(0,10,1000)';
y1 =cos(x).^2.*exp(-0.4.*x) ;
It is array operation...you don't need to index.

댓글 수: 2

thank you it works now
In MATLAB indices should be positive integers. Indices cannot be zero, negative integers and fractions.
Thanks is accepting the answer.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품

질문:

2020년 5월 8일

댓글:

2020년 5월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by