I keep getting the error "Array indices must be positive integers or logical values?"

1 回表示 (過去 30 日間)
I have been editing a code I found that models a 2 cart system using Euler's Method in an attempt to make it a 3 cart system. However, on line 63 I am recieving an error that states "Array indices must be positive integers or logical values." I am not sure what this means or how to fix it. Any help would be apprecieted. Thanks!

採用された回答

the cyclist
the cyclist 2019 年 12 月 6 日
In expressions like this one
k2(x2(n,:)-x1(n,:))
MATLAB is trying to index into the variable k2. You need to put in the multiplication sign explicitly:
k2.*(x2(n,:)-x1(n,:))

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by