Other Controllers
Visual Cue  Narration 

In order to eliminate the steady state error, we add an integrator to the proportional controller That is to say, we add a pole at origin. In order to have the root locus pass through the same point as before so as to maintain the same transient performance, we add a zero near the origin:  
PI = (s+1)/s evans(PI*System) 

sgrid(zeta, wn) Kpi = 1/real(horner(PI*System, [1 %i]*locate(1))) 
We use the same values of zeta and omega_n from the proportional controller. We now check the performance of the PI controller. 
PISystem = Kpi*PI*System/. 1 yPI = csim('step', t, PISystem); plot(t, yPI) plot(t, ones(t), 'r'), // Compare with step 
We can also compare this response with the Proportional controller 
plot(t, [ones(t); y; yPI; yProp]) 

Now, let us try to design a PD controller that has better transient performance than the plain Proportional controller. Let us aim for the following parameters: Overshoot of 0.05 and Settling time of 0.5 seconds.  
Show first slide of PD controller: OS = 0.05 Ts = 0.5 
From theory we know, <read from slide> 
zeta = sqrt((log(OS))^2/((log(OS))^2 + %pi^2)) wn = 4/(zeta*Ts) 
Therefore, we design our PD controller: 
PD = s + 20 evans(PD*System) sgrid(zeta, wn) // Zoom first, then execute next line: Kpd = 1/real(horner(PD*System, [1 %i]*locate(1))) 
You might need to go through a few trials to find the location of the pole required so that the modified root locus passes through the point of intersection of the curves corresponding to zeta and omega_n. We do not wish to waste our time here let me tell you that 20 is an appropriate location. We check the performance of the controller: 
PDSystem = Kpd*PD*System/. 1 yPD = csim('step', t, PDSystem); plot(t, yPD) plot(t, ones(t), 'r'), // Compare with step 
We note that the transient performance has improved significantly, but the steady state performance has degraded somewhat. 
Let us now try to design a PID controller by removing the steady state error from the PD controlled system, in a manner similar to how we designed a PI controller:  
PID = (s + 20)*(s+1)/s evans(PID*System) sgrid(zeta, wn) Kpid = 1/real(horner(PID*System, [1 %i]*locate(1))) PIDSystem = Kpid*PID*System/. 1 
We add a zero at origin to the PD controller.

yPID = csim('step', t, PIDSystem); plot(t, yPID) plot(t, ones(t), 'r') 
We note the significantly improved steady state as well as transient response. 
As a final step, let us compare the performance of all the controllers we have studied so far:  
plot(t, [ones(t); y; yFeedback; yProp; yPI; yPD; yPID]) legend(["Step"; "Open Loop TF"; "Closed Loop TF"; "Proportional Controller"; "PI Controller"; "PD Controller"; "PID Controller"]) 
END 