Control System Analysis, PID Control

PID – Study of the proportional action with Matlab

To make the study of proportional action, consider the following system:

1. Implement the locus of the roots indicating the points of interest. We execute the following commands in Matlab:

>> s=tf(‘s’)

>> s1=(1)/(0.2*s+1)

>> s2=(2)/(0.1*s+1)

>> s3=(1)/(s+1)

>> G=s1*s2*s3

The direct transfer function G(s) is:nullReshaping:nullIf we add a proportional controller with a gain Kp, the direct transfer function G(s) is:nullTh closed-loop transfer function Gce(s) is:null

nullThe characteristic equation is:nullThe characteristic equation in its form 1+G(s)H(s) is:


To obtain in Matlab the locus of the roots, we execute the following command:

>> rlocus(G)

We obtain:

Through this first exercise we get the locus of the roots of the system, we can observe the most immediate effect of applying a proportional controller: the displacement of the roots.

The change in the gain Kp allows us to change the value of the roots of the characteristic equation (when traveling through the blue, green and red lines of the locus in the previous graph, we see how the Kp gain changes), which is the same as changing the poles of the closed-loop transfer function. By changing these poles, we change the value of the damping coefficient ζ and the natural frequency ωn for a unit step input, thus adapting the transient response of the system to the design requirements that can be requested.

Note that the roots of the characteristic equation are in s=-10, s=-5 and s=-1, when Kp=0.

But in real terms Kp can not be zero, because in practice it means that we cancel the input to the system and thus, the output is zero as well. To represent the system operating without the proportional controller, we do Kp = 1. Under this condition, let’s see what is the value of ζ, as well as the value of three quantities of extreme importance for the designers: the overshoot Mp, the rise time Tr and the steady-state error ess. Then, suppose we want to modify this performance in terms of ζ and we vary Kp (we move the roots) until we achieve ζ = 0.5.


If Kp=1, then:null

The closed-loop transfer function Gce(s) is:

We use the following commands in Matlab to know the values of ζ, the overshoot and the time of establishment:

> >Gce=feedback(G,1)

> >damp(Gce)

We obtain:

Pole Damping Frequency
-2.26e+00 + 2.82e+00i 6.26e-01 3.62e+00
-2.26e+00 – 2.82e+00i 6.26e-01 3.62e+00
-1.15e+01 1.00e+00   1.15e+01

Note that in the previous graph, Kp = Gain = 1. The dominant complex roots are s1 = -2.26 + j2.82 and s2 = -2.26-j2.82, so that, according to the graph, we can consider ζ = 0.626 when Kp = 1. Regarding the overshoot, the rise time and the steady-state error we use the following command:

>> stepinfo(Gce)

RiseTime: 0.5626

Overshoot: 7.5449

Peak: 0.7170

>> step(Gce)

If the input is the unit step and the output reaches the final value of c = 0.663, the steady-state error is ess = 1-0.663 = 0.337. We will see that despite varying the value of Kp and moving the roots, the proportional controller does not completely cancel out the steady-state error, it will always have a value different from zero, so an integral action is required to annul this error. On the other hand, the value of the overshoot is Mp = 7.17%, taking into account that the final value of the system is c = 0.663 and the maximum value reached is of c = 0.7170.

Find Kp to achieve ζ = 0.5.

The locus of the roots allows us to vary the value of the gain Kp until reaching the requested damping, ζ = 0.5. We move on the geometric place of the roots in Matlab by clicking on the line of the dominant poles and dragging the point until it reaches the requested damping:

The previous graph shows us that we can obtain a ζ = 0.5 when the gain Kp has an approximate value of 1.46. If Kp = 1.46, the direct transfer function and the closed-loop transfer function are:

We confirm the value of the damping by:

>> Gce2=(146)/(s^3+16*s^2+65*s+196)

> >damp(Gce2)

Pole Damping Frequency
-2.04e+00 + 3.51e+00i 5.02e-01 4.05e+00
-2.26e+00  – 3.51e+00i 5.02e-01 4.05e+00
-1.19e+01 1.00e+00   1.19e+01

> >stepinfo(Gce2)

RiseTime: 0.4356

Overshoot: 15.0397

Peak: 0.8569

It is observed that the overshoot will be higher (from 7.5449 to 15.0397) after the compensation (change the Kp value from 1 to 1.46) because the damping ζ is lower (from 0.626 to 5.02), while the rise time Tr improves slightly (from 0.5626 to 0.4356)

The answers to the unit step input of both systems (before and after the compensation), can be observed by the following Matlab command:

>> step(Gce,Gce2)

The final value of the system after the compensation (in red color) is approximately c = 0.748, so the steady-state error in this case is slightly lower, ess = 1-0.748 = 0.252. It is clearly seen in the graph that the rise time is shorter after the compensation, but at the cost of a larger overshoot due to a smaller damping.

Another more sophisticated Matlab tool to design compensators is SISO Design Tool. It can be called with rltool.

>> rltool

The graphical user interface is opened (GUI).

Once there, we can import systems fron the Matlab console through file>import>G>browse>available models>G>import>close>ok.

Supongamos el requerimiento ζ=0.5. Placing the cursor on the locus, we right click and select design requirement>new>design requirement type>damping ratio>0.5>ok. 

The lower legend is obtained by placing the course on the pink dot, a hand is formed and left click. We can vary the graph until we achieve approximately the desired damping. If we place the course on the left side of the graph (white color), the legend appears Loop gain changed to 1.47. That is to say Kp=1.47.

Although, to be more exact, the value of the gain is Kp = 1.4663. This value can be seen in the other window that opens simultaneously with the Editor: Control and estimation tools manager. There, when selecting the Compensator Editor tab, we can see that C = 1.4663. Therefore, the tool allows us to be much more specific in terms of the value of the gain.

Going back to the graphic editor (SISO design task), we select analysis>response to step command, we obtain the unit step response in a new window. Once there, right click, we select plot type>step. We can see the value of main characteristics of transient response with Kp=1.46:

characteristics>rise time

characteristics>peak response

Respuesta transitoria para diferentes valores de Kp.

To complete the study it is only necessary to assign several values to Kp and analyze the transient response as well as the steady-state error of the different systems, through the programming tools presented so far. It should be noted how sensitive the system is for very close Kp values. This is shown in the following graph where the answers to the unit step input appear simultaneously for different values of Kp:

Kp=0.2, Kp=0.5, Kp=1, Kp=1.5,  Kp=1.7, Kp=2.


Step response, Kp=2



Written by: Larry Francis Obando – Technical Specialist – Educational Content Writer.

Mentoring Académico / Empresarial / Emprendedores

Copywriting, Content Marketing, Tesis, Monografías, Paper Académicos, White Papers (Español – Inglés)

Escuela de Ingeniería Eléctrica de la Universidad Central de Venezuela, Caracas.

Escuela de Ingeniería Electrónica de la Universidad Simón Bolívar, Valle de Sartenejas.

Escuela de Turismo de la Universidad Simón Bolívar, Núcleo Litoral.

Contact: Caracas, Quito, Guayaquil, Cuenca – Telf. 00593998524011

WhatsApp: +593981478463



1 pensamiento sobre “PID – Study of the proportional action with Matlab”

Deja un comentario