Too many input arguments

10 次查看(过去 30 天)
Eingylla Grace
Eingylla Grace 2022-7-24
编辑: VBBV 2022-7-24
Hello! I noticed that whenever I use the syntaxes residue() and roots(), I get the error "too many input arguments". I copy pasted this code directly from matlab's documentation, but I keep getting the error. I tried to run the code here and it works. Is there any way to fix it?
p = [3 -2 -4];
r = roots(p)
r = 2×1
1.5352 -0.8685
  1 个评论
KSSV
KSSV 2022-7-24
What does the below line show up for you?
which roots
/MATLAB/toolbox/matlab/polyfun/roots.m

请先登录,再进行评论。

回答(1 个)

VBBV
VBBV 2022-7-24
p = [3 -2 -4];
TESTE(p) ;% give the input argument matrix p for the function TESTE in command window
ans = 2×1
1.5352 -0.8685
function r = TESTE(p)
r = roots(p);
end
If you give the input argument matrix , p to the function TESTE in command window, then it will work, It seems you have not given any input arguments and calling function directly
  1 个评论
VBBV
VBBV 2022-7-24
编辑:VBBV 2022-7-24
It could also be that you dont have any input arguments to defined function file or m-file with name TESTE

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Octave 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by