Post Reply 
Script to find the root locus
12-02-2018, 03:59 PM (This post was last modified: 12-04-2018 07:24 PM by rushfan.)
Post: #3
RE: Script to find the root locus
(11-29-2018 08:41 AM)parisse Wrote:  Inside CAS, point(proot(polynomial)) will display the list of roots of a polynomial. For several polynomials you can create an empty list l and run l:=concat(l,(proot(..)) inside the loop and run point(l) after the loop.

That works better, thanks!

Code:

// This is a script to plot the root locus of a system
// Arguments are num, den coefficients of polynomial
// Stepp is the size of the change in K. If the script runs too slow, increase the stepp size. 
// Endd is the max value that K takes, if it is too slow to plot, decrease the max value. 
// Example:  rlscas([1,3],[1,7,14,8,0],0.01,10)
#cas
rlscas(num,den,stepp,endd):=
BEGIN
LOCAL K, begg, l:={};
begg:=0.001;
FOR K FROM begg TO endd STEP stepp DO
l := concat(l, proot(poly2symb(den)+K*poly2symb(num)));
END;
point(l);
END;
#end
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
RE: Script to find the root locus - rushfan - 12-02-2018 03:59 PM



User(s) browsing this thread: 1 Guest(s)