Now,

Using MATLAB command ``margin'', phase margin of the system with K = 2 is computed as 31.6° with ωg = 1.26 rad/sec, as shown in
Figure 3.
Thus the required phase lead is 50° - 31.6° = 18.4° . After adding a safety margin of 11.6° ,
becomes 30° . Hence

From the frequency response of the system it can be found out that at ω = 1.75 rad/sec, the magnitude of the system is
. Thus ωmax = ωgnew = 1.75 rad/sec. This gives

Or, 
Thus the controller in w-plane is

The Bode plot of the compensated system is shown in Figure 4.
Re-transforming the above controller into z -plane using the relation
, we get the controller in z -plane, as
