Why does the complex phase plot look exactly like the root locus diagram

complex-analysiscontrol theory

BRIEF BACKGROUND

Basically here's an interesting discovery I made (probably not an original discovery) when playing around with MATLAB the other day. I was basically just trying to make a good visualization of complex valued plots and trying to implement an HSV (hue, saturation, value) model of coloring a complex function.

But my first step was just to plot the phase and magnitude separately with standard MATLAB colorings and this is when I made the interesting discovery that the phase plot of a complex valued function looks exactly like the root locus diagram of that function. This obviously cannot be a coincidence as when I change the poles and zeros the root locus diagram looks exactly the same.

For those who are not familiar with root locus diagrams, they are useful tool in control systems to know where the poles and zeros of a system go when you change the feedback gain. If your open loop gain transfer function $L(s)$ is described by a polynomial and has certain poles and zeros when it is connected in a feedback system with a gain $K$ the poles and zeros of the total system move as $K$ is increased or decreased.

Feedback System

MATLAB CODE

clearvars
clc
clf
format long

%% Complex Plotting Tools
% Setup our grid of complex values to cover the complex plane
z_real = linspace(-5, 5, 1000);
z_imag = linspace(-5, 5, 1000);
[RealZ, ImagZ] = meshgrid(z_real, z_imag);
z = RealZ + ImagZ * 1j;

% Set up the coefficients of our complex polynomial
% Define a function based off the numerator/denominator coefficients

zrs = [-1]';
pls = [-2+1j, -2-1j, -3]';
[num_poly, den_poly] = zp2tf(zrs, pls, 1);
f = @(x)(polyval(num_poly, x) ./ polyval(den_poly, x));

% Print the roots of the polynomials
disp(roots(num_poly));
disp(roots(den_poly));

% Plot the complex magnitude in these plots
figure(1)
hold on
grid on
surf(RealZ, ImagZ, log(abs(f(z))), 'EdgeColor', 'none');
colormap jet
colorbar

% Plot the complex phase in these plots
figure(2)
hold on
grid on
surf(RealZ, ImagZ, rad2deg(angle(f(z))), 'EdgeColor', 'none');
colormap jet
colorbar

%% Root Locus Plot
% Generate a pole/zero plot of the same system
% Generate a root locus plot of the same system

F = tf(num_poly, den_poly);

figure(3)
hold on
grid on
pzplot(F);

figure(4)
hold on
grid on
rlocus(F);

PLOT DIAGRAMS

Magnitude Plot of Complex Function

Phase of a Complex Function

Pole Zero Diagram

Root Locus Diagram of Complex Function

QUESTION

So my question is this: Why does the phase plot of the complex valued function look exactly like its corresponding root locus diagram? I'm going to work on this myself to see if I can figure it out but figured I'd toss this question out to the larger community.

Best Answer

Let $L: \mathbb{C}\to\mathbb{C}$ be the loop transfer function. A necessary and sufficient condition for a point $s\in\mathbb{C}$ to be on the root locus is the angle criterion. Specifically,

$$0 = 1 + K L(s) \implies \measuredangle \frac{-1}{K} = \measuredangle L(s) \implies \pi = \measuredangle L(s).$$

That is, it is a point $s$ of the root locus is such that the phase of $L(s)$ to is $\pi.$ That phase is very special, because it is where you often run into "wrap-around" issues when you colour the phase plot. You can see this if you look carefully at your phase plot of $L(s).$ Notice points on the root locus are precisely where there is a crossing from $180^\circ$ to $-179^\circ.$

So this is just an artifact of the angle criterion.

Related Question