Pole-Zero Cancellation

When an open-loop system has right-half-plane poles (in which case the system is unstable), one idea to alleviate this problem is to add zeros at the same locations as the poles, to cancel the unstable poles. Unfortunately, this method is unreliable. The problem is that when the added zero does not exactly cancel the pole (which is always the case in real life), a part of the root locus will be trapped in the right-half plane. This causes the closed-loop response to be unstable. The following example demonstrates this concept.

Suppose we have an open-loop transfer function:

Create a new m-file, and enter:

```num = 1;
den = [3 2 -1];
plant = tf(num,den);
rlocus(plant)
```
This should give you the root locus of this open-loop system: Run the m-file and you should get the following root locus plot:

We see that one of the open-loop poles is at the right-half plane. The closed-loop response will be unstable if the gain is selected such that one of the poles is in the right half plane. We can make this system stable by choosing the correct gain, but let's see if we can make the system stable by doing a pole-zero cancellation. Inspecting the root locus above, we see that the unstable pole is at the vicinity of 0.3. Delete the rlocus command, and add the following lines into your m-file to add a zero at -0.3:

```z = -0.3;
zero = tf([1,z],1);
rlocus(zero*plant)
```

From the new root locus you can see that the unstable pole has almost been canceled. Now let's see what the closed-loop response look like. Add the following to the end of your m-file:

```sys_cl = feedback(zero*plant,1);
step(sys_cl,100)```

The system is still unstable. The reason for this is that the zero does not exactly cancel the unstable pole. Can we make the system stable by moving the zero so that it's exactly on the pole? From the original transfer function, you know that the open-loop pole is actually at 1/3. What if we put our zero at exactly 1/3? Go back to the m-file and change Zero to 1/3:

```z = -1/3
```
Rerun the m-file, and you should get the following root locus plot:

This time we see that the zero is right on the unstable pole (you may use zoom command to zoom into the plot, to see that the zero is exactly on the pole). What does the closed-loop response look like now, is it stable? Look at the step response plot to find out:

No, it's still unstable! The response takes much longer to blow up, so we have almost canceled the effect, but almost is not good enough when the question is stability. A system which is "almost stable" is still unstable, and its response will go to infinity.

From the example above, we see that the pole-zero cancellation is theoretically okay, but practically unobtainable. A solution to this example can be found using the method introduced in the root locus tutorial. Noted that an improper system (a system with more zeros than poles) is not realizable using any physical system. In this example, we use only one zero for simplicity.