Getting Started | ![]() ![]() |
Constructing SISO Models
Once you have a set of differential equations that describe your plant, you can construct SISO models using simple commands in the Control System Toolbox. The following sections discuss:
Constructing a State-Space Model of the DC Motor
Listed below are nominal values for the various parameters of a DC motor.
R= 2.0 % Ohms L= 0.5 % Henrys Km = .015 % Torque constant Kb = .015 % emf constant Kf = 0.2 % Nms J= 0.02 % kg.m^2/s^2
Given these values, you can construct the numerical state-space representation using the ss
function.
A = [-R/L -Kb/L; Km/J -Kf/J] B = [1/L; 0]; C = [0 1]; D = [0]; sys_dc = ss(A,B,C,D)
This is the output of the last command.
a = x1 x2 x1 -4 -0.03 x2 0.75 -10 b = u1 x1 2 x2 0 c = x1 x2 y1 0 1 d = u1 y1 0
Converting Between Model Representations
Now that you have a state-space representation of the DC motor, you can convert to other model representations, including transfer function (TF) and zero/pole/gain (ZPK) models.
Transfer Function Representation. You can use tf
to convert from the state-space representation to the transfer function. For example, use this code to convert to the transfer function representation of the DC motor.
sys_tf = tf(sys_dc) Transfer function: 1.5 ------------------ s^2 + 14 s + 40.02
Zero/Pole/Gain Representation. Similarly, the zpk
function converts from state-space or transfer function representations to the zero/pole/gain format. Use this code to convert from the state-space representation to the zero/pole/gain form for the DC motor.
sys_zpk = zpk(sys_dc) Zero/pole/gain: 1.5 ------------------- (s+4.004) (s+9.996)
Note The state-space representation is best suited for numerical computations. For highest accuracy, convert to state space prior to combining models and avoid the transfer function and zero/pole/gain representations, except for model specification and inspection. See Reliable Computations online for more information on numerical issues. |
Constructing Transfer Function and Zero/Pole/Gain Models
In the DC motor example, the state-space approach produced a set of matrices that represents the model. If you choose a different approach, you can construct the corresponding models using tf
, zpk
, ss
, or frd
.
sys = tf(num,den) % Transfer function sys = zpk(z,p,k) % Zero/pole/gain sys = ss(a,b,c,d) % State-space sys = frd(response,frequencies) % Frequency response data
For example, if you want to create the transfer function of the DC motor directly, use these commands.
s = tf('s'); sys_tf = 1.5/(s^2+14*s+40.02)
The Control System Toolbox builds this transfer function.
Transfer function: 1.5 -------------------- s^2 + 14 s + 40.02
Alternatively, you can create the transfer function by specifying the numerator and denominator with this code.
sys_tf = tf(1.5,[1 14 40.02]) Transfer function: 1.5 ------------------ s^2 + 14 s + 40.02
To build the zero/pole/gain model, use this command.
sys_zpk = zpk([],[-9.996 -4.004], 1.5)
This is the resulting zero/pole/gain representation.
Zero/pole/gain: 1.5 ------------------- (s+9.996) (s+4.004)
![]() | SISO Example: the DC Motor | Discrete Time Systems | ![]() |