I have a code, but I have an error, please help

X=roots((1 2(l^2-s^2-2*l^2*cosd(th)^2)(l^2-s^2)^2))
Error: invalid expression. Check for missing multiplication operator, missing or unbalanced delimited,use brackets instead of parentheses.

1 件のコメント

KSSV
KSSV 2021 年 6 月 16 日
Check the expression inside root.

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

回答 (1 件)

Walter Roberson
Walter Roberson 2021 年 6 月 16 日

0 投票

MATLAB has no implied multiplication at all. 2(l^2) is invalid syntax because there is no operation between the 2 and the (l^2)
Also, roots() must be passed a vector of values.
What could potentially be valid is
X=roots([1, 2, (l^2-s^2-2*l^2*cosd(th)^2), (l^2-s^2)^2] )
but I have no idea if that is what you wanted.

カテゴリ

ヘルプ センター および File ExchangeEntering Commands についてさらに検索

質問済み:

2021 年 6 月 16 日

回答済み:

2021 年 6 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by