-2
\$\begingroup\$

I am following this tutorial on root locus methods and when writing:

syms s
sys = 1/(3*s^2 + 2*s - 1);
rlocus(sys)

I get:

Error using rlocus
Not enough input arguments.

Why is rlocus expecting more input arguments when the documentation states that one input argument is enough?


rlocus(SYS) computes and plots the root locus of the single-input, single-output LTI model SYS. The root locus plot is used to analyze the negative feedback loop

Syntax for rlocus:

rlocus(sys)
rlocus(sys1,sys2,...)
[r,k] = rlocus(sys)
r = rlocus(sys,k)

When writing:

s = tf('s');
P = 1/(3*s^2 + 2*s - 1);
rlocus(P)

I get:

Error using InputOutputModel/subsref (line 43) The name "s" does not match any channel or group.

Error in s = tf('s');

so I am using syms s which is used to define symbolic variables.

Strangely which rlocus returns ...Program Files\MATLAB\R2018a\toolbox\control\ctrlobsolete\rlocus.m which is in the obsolete folder.

\$\endgroup\$
  • \$\begingroup\$ >> Num=1; >> Den=[3 2 -1]; >> G=tf(Num,Den); >> rlocus(G) \$\endgroup\$ – Chu Dec 27 '18 at 15:00
  • \$\begingroup\$ @Chu, this seems correct as per documentation but gives me the error Subscript no. 2 is out of range.. I am unable to determine why this is happening. \$\endgroup\$ – Rrz0 Dec 27 '18 at 15:23
  • \$\begingroup\$ Have you run my progam? I've run that exact program on Matlab 2018 and it works fine. Is control systems toolbox in the obsolete folder? If so, it wont work! \$\endgroup\$ – Chu Dec 27 '18 at 16:01
  • \$\begingroup\$ Try 'help rlocus' instead of 'which rlocus'. I've not seen the latter command before. \$\endgroup\$ – Chu Dec 27 '18 at 16:10
  • \$\begingroup\$ Thanks for your comments, they helped me solve the pending issue. which is a handy command which is used to locate functions and files. help rlocus now gives the expected help on how to use the function. \$\endgroup\$ – Rrz0 Dec 27 '18 at 16:12
0
\$\begingroup\$
sys = tf([1],[3 2 -1]); 
rlocus(sys); 
\$\endgroup\$
  • \$\begingroup\$ Thanks for your answer. That still gives me an error on MATLAB 2018a: Subscript no. 2 is out of range. \$\endgroup\$ – Rrz0 Dec 27 '18 at 14:49
  • \$\begingroup\$ @Rrz0 check your syntax. I was going to post this until I saw spehroPefhany posted it. I have just confirmed it in R2018b and R2018a, R2017b \$\endgroup\$ – JonRB Dec 27 '18 at 15:35
  • 1
    \$\begingroup\$ Thanks for your comments and answer. Turns out I was using an obselete version of rlocus. \$\endgroup\$ – Rrz0 Dec 27 '18 at 16:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.