Search code examples
matlabcontrolsroot

Alternative to rlocfind to find intersection of line of constant damping ratio with root locus in Matlab


To find the gain at the point where the root locus intersects a line of constant damping ratio, the rlocfind function can be used, but the user has to manually select a point and Matlab finds the closest point on the root locus to the selection. Is there a way to find the exact point of intersection without having to make the selection manually?

h = tf([2 5 1],[1 2 3]);
rlocus(h)         
z = 0.707; sgrid(z,0)
k = rlocfind(h)  

Can the value of gain be found without using rlocfind if the correct gain value is greater than 1? For example, for the following transfer function the gain value should be 23.4.

h = tf(1,poly([-2 -4 -6]))
 
minfun = @(k) (0.75 - tf2dampingratio(h, k))^2;
gain = fminbnd(minfun, 0, 1)  % 0.1970

rlocus(h)         % Root locus
ylim([-3 3])
z = 0.75; sgrid(z,0)
K = rlocfind(h)

function dampingratio = tf2dampingratio(h, k)
  [num, den] = tfdata(h); 
  poles = roots(den{:} + k * num{:});
  dampingratio = cos(pi - angle(poles(1))) 
end

Solution

  • I don't know of a MATLAB function that can do that directly. We can, however, write a small function to do the calculation for us. We know that the root locus is the plot of how the poles of a system move when used in negative feedback with some gain (see the MATLAB docs). And the damping ratio is the cosine of the angle the pole makes with the negative real axis (illustration from Wikipedia).

    h = tf([2 5 1],[1 2 3]);
    minfun = @(k) (0.707 - tf2dampingratio(h, k))^2;
    gain = fminbnd(minfun, 0, 1); % 0.1970
    
    function dampingratio = tf2dampingratio(h, k)
      [num, den] = tfdata(h);
      poles = roots(den{:} + k * num{:});
      dampingratio = cos(pi - angle(poles(1)));
    end
    

    Root Locus Damping Ration (and Natural Frequency