Rooting the Locus (25 pts)
In this problem, you will design a function to visualize the basic root-locus.
a. (100%) Design a function rootlocus(G) that takes an open-loop transfer function and returns a plot of the root-locus, showing the zeros and the open-loop poles.
By definition, the root-locus gives all the solutions of the characteristic equation 1 + KG(s) = 0 on the s-plane for 0 < K < ∞. So, to plot the root-locus, you can solve for the roots of the characteristic polynomial numerically by varying the value of K and plotting the result.
You can use MATLAB's built-in pole() and zero() commands.
Helpful questions:
- How many root-locus segments do you have?
- How many arrays do you need to store the results of pole locations, as you vary K?
- Compare your result with MATLAB's built-in rlocus.