# Root Locus Method in MATLAB

To start out, setup the open loop transfer function.

$G(s)H(s) = \frac{K*(numerator)}{(denominator)}$

Next, you can choose to set up the MATLAB code in a few different ways. First make sure that both the numerator and denominator are in acceptable forms.

[1 2 3] is the same as saying $s^{2}+2s+3$

Using an example:

$G(s)H(s) = \frac{K}{(s+8)}$

We can write the numerator and denominator MATLAB codes as:

>>numerator=[1];

>>denominator=[1 8];

For a more complex problem we can bypass the long and tedious expansion process and use the convolution function in MATLAB.

$G(s)H(s)=\frac{K}{(s+1)(s^2+6s+18)}$

Here, the denominator is also represented by (s+1)*(s+3+3j)*(s+3-3j). Being three seperate parts, we can use convolution once for two of them, then use convolution again with the remaining part. Just look at the example:

conv( A , conv( B , C ) )  —> denominator = conv( [1 1], conv( [1 3+3*j], [1 3-3*j] ) );

After we define our numerator and denominator in MATLAB, we can use the root locus function then set our axis parameters as follows.

>>rlocus( numerator, denominator )

>>axis([-10 10 -10 10])

Your plot should look similar to the following for this example: