Getting "Execution of script roots as a function is not supported:" error

222 ビュー (過去 30 日間)
Chinmay Raval
Chinmay Raval 2021 年 7 月 6 日
コメント済み: Saugyan Chapain 2022 年 4 月 26 日
Hi,
I am trying to find the roots of an equation x = x^3 + 4*x^2 - 8* x -12
Below is my script:
x = [1,4,-8,-12];
y = roots(x)
I have saved this code in flie_3.m script and numming it and its giving me error as
"Execution of script roots as a function is not supported:"

採用された回答

Kojiro Saito
Kojiro Saito 2021 年 7 月 6 日
It seems you have another roots.m file which is different from MATLAB's built-in roots function.
Please check the following command
which roots -all
You will get custom roots.m (in bold) and built-in roots.m files.
<SOME_PATH>\roots.m
<MATLAB_ROOT>\toolbox\parallel\gpu\@gpuArray\roots.m % gpuArray method
<MATLAB_ROOT>\toolbox\matlab\polyfun\roots.m % Shadowed
Rename the custom roots.m file to such as myRoots.m.
  1 件のコメント
Saugyan Chapain
Saugyan Chapain 2022 年 4 月 26 日
Thank you. It was very helpful

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

その他の回答 (0 件)

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by