# Finding the overall transfer function and plotting root locus of a digital control system

I have started to learn about digital control theory and struggling with a particular diagram of a digital control system. The system is presented below:

$$\D(z)\$$ is a digital compensator, $$\G_{h0}\$$ is a zero order hold circuit with adjustable gain $$\k_2\$$. The blocks $$\G_{p1}\$$ and $$\G_{p2}\$$ are part of the DC motor model. The sampling time is $$\0.1\$$s.

Given the motor parameters, $$\G_{p1}\$$ is found to be:

$$G_{p1}(s) = \frac{K_t}{JLs^2 + (JR+bL)s +bR + K_e K_t}$$

and $$\G_{p2}\$$:

$$G_{p2}(s) = \frac{1}{s}$$

The motor parameters are:

% DC motor constants
J=0.01; % Rotor momentum of inertia
b=0.01; % viscous friction
kt=0.01; % torque constant
ke=0.01; % electromotive force constant
k2 = 1; % ZOH gain
R=1;    % rotor resistance
L=0.5;  % inductor resistance
T = 0.1; % sampling time
s = tf('s');
z = tf('z');


Step 1: Open Loop subsystem $$\k_2 * G_ho * G_p1\$$

num=kt*k2;
den=[J*L J*R+b*L b*R+ke*kt];
ol_cont=tf(num,den);

ol_discrete = c2d(ol_cont,0.1)

ol_discrete =

0.009056 z + 0.008194
----------------------
z^2 - 1.723 z + 0.7408


Step 2: Closed Loop subsystem

cl_discrete = feedback(ol_discrete,-1)

cl_discrete =

0.009056 z + 0.008194
----------------------
z^2 - 1.732 z + 0.7326


Step 3: Overall Open Loop Excluding compensator

overall_ol_discrete = cl_discrete*(z/(z-1))

overall_ol_discrete =

0.009056 z^2 + 0.008194 z
----------------------------------
z^3 - 2.732 z^2 + 2.465 z - 0.7326

overall_ol_discrete_zpk =

0.0090558 z (z+0.9048)
---------------------------
(z-1) (z-0.9994) (z-0.7331)


Step 4: Overall Closed Loop

overall_cl_discrete = feedback(overall_ol_discrete,-1)
overall_cl_discrete =

0.009056 z^2 + 0.008194 z
----------------------------------
z^3 - 2.742 z^2 + 2.457 z - 0.7326


I am then asked to design a compensator that ensures system dynamic behavior defined by the dynamic ratio of gzita = 0.7 and $$\ w_n = 3rad/s\$$.

If I use overall_ol_discrete found above, this is not possible via Matlab ControlSystemDesigner. Since Matlab fails to solve for this compensator, it means that either (1) the design paramaters are incorrect or more likely, (2) the plant I have found as described above is incorrect.

Therefore, is the working above to achieve the overall closed loop transfer function correct?

Any suggestions would be appreciated.

As per the suggesion below.

rlocus(overall_ol_discrete* D_z)


This is the closest I have managed to come unfortunately, I cannot find a compensator to get to the required specs.

Step response:

• plot the root locus of overall_ol_discrete, also, use zgrid to see the damping and frequency lines. if the rlocus does not go over/close to the desired place (the crossing between the desired damping line and natural frequency) introduce a pair of pole+zero that are stable to change the path of the curve. – jDAQ Feb 7 at 18:24
• Thank you for your suggestion, will do so and update the question. Any comments on the working . Ishow above to obtain the transfer function? – rrz0 Feb 7 at 19:09
• With regards to your suggestion, I did this with ControlSystemDesigner, and used Optimasation Based Tuning. Matlab failed to find the right poles and zeros for the plant I present above. – rrz0 Feb 7 at 19:16

## 1 Answer

By picking the a compensator I was able to get the result you want, try some (stable) poles cancellation or place the zeros very close to the poles. By picking different compensator you should be able to change how the root locus behaves. So, instead of using Optimization Based Tuning try a combination of:

1. Create a compensator D(z) with both poles and zeros inside the unit disc
2. Use rlocus(D*overall_ol_discrete)
3. Are the poles moving inside the unit disc? If not, go back to 1 and try big changes in D(z)
4. Are the poles moving near/across the desired loci? If not, go back to 1 and make small changes to D(z)
5. Find for which gain $$\k\$$ the dominating poles are in the desired loci.

These are the results I got by using a $$D(z) =\frac{z-0.98}{z+0.9}$$

• Thank you for you answer. So is D(z) of the form: $k_1*(z-p_c)/(z-p_c)$ ? Or does it contain two poles and two zeros? I am asking since the markers on the first diagram or not quite visible. – rrz0 Feb 8 at 7:56
• My D(z) has one pole and one zero, the gain will be determined using rlocus, so there is no need to include it in the compensator right away. – jDAQ Feb 8 at 8:10
• overall_ol_discrete has three real poles at $(z-1) (z-0.9994) (z-0.7331)$. You suggest "place the zeros very close to the poles". Does this mean one should try to cancel out the pole at $0.7331$, which has the most effect on dynamic behaviour? I set the zero of my compensator to this value for pole cancellation and tweak the compensator's pole to see the change in root locus. Have I understood you correctly? – rrz0 Feb 8 at 8:24
• Thank you for the update, unfortunately this does not seem to get the required response. I updated the locus and response to a step input above. – rrz0 Feb 8 at 21:58
• Try increasing the compensator to a higher order one as $D(z) = \frac{(z-0.98)(z-0.96)}{(z+0.9)(z+87)}$ and also, how come you're getting unstable responses? Are you picking the k using whatever Matlab function and not even checking stability? – jDAQ Feb 8 at 22:13