MATLAB: Plotting root locus with variables in transfer function

Control System Toolboxcontrol systemsroot locus

Hi. I've been using matlab to plot root loci for my control systems class but I ran into a problem with a recent assignment. This particular problem asks me to plot the root locus of a system in which the transfer function has a variable gain in addition to numeric terms. I just don't have the matlab experience to figure out how to do this on my own with the help command. It would be greatly appreciated if anyone could help me with this. Thank you.

Best Answer

If G(p) is your system transfer function, The transfer function of your system in a closed loop with gain k is Gc(p)=G(p)/(1+k.G(p))
%you are looking for closed loop system poles depending on k vakues
G=tf([1 10],[1 2 1]) % your system in open loop
k=0:0.1:100; % k values
rlocus(G,k); % your poles in closed loop
%or
rlocus(G);