Post Reply 
Script to find the root locus
11-27-2018, 04:56 PM (This post was last modified: 11-27-2018 05:03 PM by rushfan.)
Post: #1
Script to find the root locus
The root locus part of the Control Systems program in this forum does not work.
I wrote a little script that can generate the root locus of a system, with instructions on how to plot.
With thanks to members @ThomasA and @Tim Wessman for suggestions on how to properly plot it.
Here is the code:


// This is a script to find the root locus of system
// Arguments are num, den coefficients of polynomial
// Stepp is the size of the change in K
// Endd is the max value that K takes
// Example:  rls([1,3],[1,7,14,8,0],0.01,10)
// To use this program:
// In the Statistics 2var, symbolic
// Set independent varibale to L0
// Set dependent variable to L1
// Plot

EXPORT rls(num, den, stepp, endd)
LOCAL begg;
LOCAL xv:={};
LOCAL yv:={};
FOR K FROM begg TO endd STEP stepp DO
xv := concat(xv, RE(POLYROOT(poly2symb(den)+K*poly2symb(num))));
yv := concat(yv, IM(POLYROOT(poly2symb(den)+K*poly2symb(num))));
L0:= xv;
L1 := yv;
Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
Script to find the root locus - rushfan - 11-27-2018 04:56 PM

User(s) browsing this thread: