Filter löschen
Filter löschen

finding roots of equation in matlab

1 Ansicht (letzte 30 Tage)
qudsia Bashir
qudsia Bashir am 21 Nov. 2019
Kommentiert: Vladimir Sovkov am 21 Nov. 2019
I want to find roots of an equation using roots command.My code is
p=[1 0.45 0 -0.0133 -0.08 0 0.016]
r=roots(p)
but when i run it matlab gives error
Error=Attempt to execute SCRIPT roots as a function
Someone kindly help me to remove this error i willbe very thankful to u.

Antworten (1)

Nicolas B.
Nicolas B. am 21 Nov. 2019
I would be you, I would check whether you don't have any home-made script named roots in your MATLAB path.
If you have no idea where it could be, maybe run it first once with:
roots;
Then, maybe, the output of the script would give you some hints.
  1 Kommentar
Vladimir Sovkov
Vladimir Sovkov am 21 Nov. 2019
This may be the case indeed. The in-built Matlab "roots" works perfectly
p=[1 0.45 0 -0.0133 -0.08 0 0.016];
>> roots(p)
ans =
-0.0941615598738199 + 0.564658612501628i
-0.0941615598738199 - 0.564658612501628i
-0.576214580558998 + 0i
-0.474450496188147 + 0i
0.394494098247393 + 0.151545050491967i
0.394494098247393 - 0.151545050491967i

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by