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 日

0 投票

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

2 件のコメント

Valter Ferletta
Valter Ferletta 2020 年 5 月 8 日
thank you it works now
KSSV
KSSV 2020 年 5 月 8 日
In MATLAB indices should be positive integers. Indices cannot be zero, negative integers and fractions.
Thanks is accepting the answer.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMatrix 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