フィルターのクリア

>>root([1 -1 -2]) for a polynomial is not working.

3 ビュー (過去 30 日間)
Torre Kakuk
Torre Kakuk 2017 年 1 月 16 日
編集済み: Image Analyst 2017 年 1 月 16 日
It returns
"Undefined function 'root' for input arguments of type 'double'."
I also tried
>> c = [3 -2 1 2 0 -1];
roots(c)
which returned
"Attempt to execute SCRIPT roots as a function:
C:\Users\Christi\Documents\MATLAB\roots.m"

回答 (2 件)

Adam
Adam 2017 年 1 月 16 日
There is no 'root' function in Matlab or its toolboxes that I am aware of.
doc roots
is a function, but you have hidden it with your own script of the same name. Rename your script to something else.
In future, try to remember to do e.g.
which roots
before deciding to name your own function or variable 'roots' to check you aren't over-riding an existing function.

Niels
Niels 2017 年 1 月 16 日
the first error results in a spelling mistake:
you typed root instead of roots, the second works fine:
>> c = [3 -2 1 2 0 -1]
c =
3 -2 1 2 0 -1
>> roots(c)
ans =
0.5911 + 0.9284i
0.5911 - 0.9284i
0.6234 + 0.0000i
-0.5694 + 0.3423i
-0.5694 - 0.3423i

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by