フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

"Array indices must be positive integers or logical values" on solving a cubic equation

1 回表示 (過去 30 日間)
Shikhar Sharma
Shikhar Sharma 2019 年 9 月 9 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I am getting the error "Array indices must be positive integers or logical values" on solving a cubic equation.
c1 = 0.6;
c2 = 0.095;
c3 = 47500;
c4 = 0.0026;
wBar = [-c2*c4 -0.106*c2 -36.6*c2 c3*c1];
disp(roots(wBar));
Kindly help.
  2 件のコメント
Walter Roberson
Walter Roberson 2019 年 9 月 9 日
Works for me. I suspect that earlier you accidentally defined a variable named roots and it is still in you workspace.
clear roots
Shikhar Sharma
Shikhar Sharma 2019 年 9 月 9 日
Thank you Walter! Works now.

回答 (1 件)

madhan ravi
madhan ravi 2019 年 9 月 9 日
Either you must have a variable named roots or disp , therefore clear it from workspace:
clear roots disp

この質問は閉じられています。

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by