'Error - Array indices must be positive integers or logical values

1 回表示 (過去 30 日間)
Harrison Dove
Harrison Dove 2020 年 8 月 9 日
回答済み: Walter Roberson 2020 年 8 月 9 日
Hey could anyone help me to figure out why i would be getting this error?

採用された回答

Walter Roberson
Walter Roberson 2020 年 8 月 9 日
t1 = 0;
t2 = 0.04;
So t2-t1 is 0.04 - 0 = 0.04
x_2 = v_x1(t2-t1)+x_1
That code attempts to index v_x1 at location t2-t1 which is v_x1 at index 0.04 which is not valid.
Reminder: MATLAB has absolutely no implied multiplication. None . Not even in the Symbolic Engine. If you want to multiply v_x1 by something then you need .* or * as appropriate.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by