%% rootlocus.m Root locus of a feedback control system
% vector of gains
K=0:1:1000;
% loop gain
numK=[2 1];
denK=[1 -1];
numP=[1];
denP=[1 2 4];
numL=conv(numK,numP);
denL=conv(denK,denP);
polesL=roots(denL);
zerosL=roots(numL);
L=tf(numL,denL);
% root locus
rlocus(L,K);
