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

430 views (last 30 days)
Chinmay Raval
Chinmay Raval on 6 Jul 2021
Commented: Saugyan Chapain on 26 Apr 2022 at 1:27
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:"

Accepted Answer

Kojiro Saito
Kojiro Saito on 6 Jul 2021
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.

More Answers (0)

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!