Main Content

Linear (LTI) Models

What Is a Plant?

Typically, control engineers begin by developing a mathematical description of the dynamic system that they want to control. The system to be controlled is called a plant. As an example of a plant, this section uses the DC motor. This section develops the differential equations that describe the electromechanical properties of a DC motor with an inertial load. It then shows you how to use the Control System Toolbox™ functions to build linear models based on these equations.

Linear Model Representations

You can use Control System Toolbox functions to create the following model representations:

  • State-space models (SS) of the form

    dxdt=Ax+Buy=Cx+Du

    where A, B, C, and D are matrices of appropriate dimensions, x is the state vector, and u and y are the input and output vectors.

  • Transfer functions (TF), for example,

    H(s)=s+2s2+s+10

  • Zero-pole-gain (ZPK) models, for example,

    H(z)=3(z+1+j)(z+1j)(z+0.2)(z+0.1)

  • Frequency response data (FRD) models, which consist of sampled measurements of a system's frequency response. For example, you can store experimentally collected frequency response data in an FRD model.

    Note

    The design of FRD models is a specialized subject that this topic does not address. See Frequency Response Data (FRD) Models for a discussion of this topic.

SISO Example: The DC Motor

A simple model of a DC motor driving an inertial load shows the angular rate of the load, ω(t), as the output and applied voltage, υapp(t), as the input. The ultimate goal of this example is to control the angular rate by varying the applied voltage. This figure shows a simple model of the DC motor.

A Simple Model of a DC Motor Driving an Inertial Load

In this model, the dynamics of the motor itself are idealized; for instance, the magnetic field is assumed to be constant. The resistance of the circuit is denoted by R and the self-inductance of the armature by L. If you are unfamiliar with the basics of DC motor modeling, consult any basic text on physical modeling. With this simple model and basic laws of physics, it is possible to develop differential equations that describe the behavior of this electromechanical system. In this example, the relationships between electric potential and mechanical force are Faraday's law of induction and Ampère's law for the force on a conductor moving through a magnetic field.

Mathematical Derivation

The torque τ seen at the shaft of the motor is proportional to the current i induced by the applied voltage,

τ(t)=Kmi(t)

where Km, the armature constant, is related to physical properties of the motor, such as magnetic field strength, the number of turns of wire around the conductor coil, and so on. The back (induced) electromotive force, υemf, is a voltage proportional to the angular rate ω seen at the shaft,

υemf(t)=Kbω(t)

where Kb, the emf constant, also depends on certain physical properties of the motor.

The mechanical part of the motor equations is derived using Newton's law, which states that the inertial load J times the derivative of angular rate equals the sum of all the torques about the motor shaft. The result is this equation,

Jdwdt=τi=Kfω(t)+Kmi(t)

where Kfω is a linear approximation for viscous friction.

Finally, the electrical part of the motor equations can be described by

υapp(t)υemf(t)=Ldidt+Ri(t)

or, solving for the applied voltage and substituting for the back emf,

υapp(t)=Ldidt+Ri(t)+Kbω(t)

This sequence of equations leads to a set of two differential equations that describe the behavior of the motor, the first for the induced current,

didt=RLi(t)KbLω(t)+1Lυapp(t)

and the second for the resulting angular rate,

dωdt=1JKfω(t)+1JKmi(t)

State-Space Equations for the DC Motor

Given the two differential equations derived in the last section, you can now develop a state-space representation of the DC motor as a dynamic system. The current i and the angular rate ω are the two states of the system. The applied voltage, υapp, is the input to the system, and the angular velocity ω is the output.

ddt[iω]=[RLKbLKmJKfJ][iω]+[1L0]υapp(t)

State-Space Representation of the DC Motor Example

y(t)=[01][iω]+[0]υapp(t)

Building SISO Models

After you develop a set of differential equations that describe your plant, you can construct SISO models using simple commands. The following sections discuss

  • Constructing a state-space model of the DC motor

  • Converting between model representations

  • Creating transfer function and zero/pole/gain models

Constructing a State-Space Model of the DC Motor

Enter the following 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

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)

These commands return the following result:

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.

Constructing Transfer Function and Zero/Pole/Gain Models

In the DC motor example, the state-space approach produces 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, 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

Alternatively, 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)

These commands result in this transfer function.

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 command returns the following zero/pole/gain representation.

Zero/pole/gain:
        1.5
-------------------
(s+9.996) (s+4.004)

Constructing Discrete Time Systems

The Control System Toolbox software provides full support for discrete-time systems. You can create discrete systems in the same way that you create analog systems; the only difference is that you must specify a sample time period for any model you build. For example,

sys_disc = tf(1, [1 1], .01);

creates a SISO model in the transfer function format.

Transfer function:
  1
-----
z + 1
 
Sample time: 0.01

Adding Time Delays to Discrete-Time Models

You can add time delays to discrete-time models by specifying an input delay, output delay, or I/O delay when building the model. The time delay must be a nonnegative integer that represents a multiple of the sample time. For example,

sys_delay = tf(1, [1 1], 0.01,'ioDelay',5)

returns a system with an I/O delay of 5 s.

Transfer function:
           1
z^(-5) * -----
         z + 1
 
Sample time: 0.01

Adding Delays to Linear Models

You can add time delays to linear models by specifying an input delay, output delay, or I/O delay when building a model. For example, to add an I/O delay to the DC motor, use this code.

sys_tfdelay = tf(1.5,[1 14 40.02],'ioDelay',0.05)

This command constructs the DC motor transfer function, but adds a 0.05 second delay.

Transfer function:
                      1.5
exp(-0.05*s) * ------------------
               s^2 + 14 s + 40.02

For more information about adding time delays to models, see Time Delays in Linear Systems.

LTI Objects

For convenience, Control System Toolbox software uses custom data structures called LTI objects to store model-related data. For example, the variable sys_dc created for the DC motor example is called an SS object. There are also TF, ZPK, and FRD objects for transfer function, zero/pole/gain, and frequency data response models respectively. The four LTI objects encapsulate the model data and enable you to manipulate linear systems as single entities rather than as collections of vectors or matrices.

To see what LTI objects contain, use the get command. This code describes the contents of sys_dc from the DC motor example.

get(sys_dc)
                A: [2×2 double]
                B: [2×1 double]
                C: [0 1]
                D: 0
                E: []
           Scaled: 0
        StateName: {2×1 cell}
        StateUnit: {2×1 cell}
    InternalDelay: [0×1 double]
       InputDelay: 0
      OutputDelay: 0
               Ts: 0
         TimeUnit: 'seconds'
        InputName: {''}
        InputUnit: {''}
       InputGroup: [1×1 struct]
       OutputName: {''}
       OutputUnit: {''}
      OutputGroup: [1×1 struct]
            Notes: [0×1 string]
         UserData: []
             Name: ''
     SamplingGrid: [1×1 struct]

You can manipulate the data contained in LTI objects using the set command; see the Control System Toolbox online reference pages for descriptions of set and get.

Another convenient way to set or retrieve LTI model properties is to access them directly using dot notation. For example, if you want to access the value of the A matrix, instead of using get, you can type

sys_dc.A

at the MATLAB® prompt. This notation returns the A matrix.

ans =

   -4.0000   -0.0300
    0.7500  -10.0000

Similarly, if you want to change the values of the A matrix, you can do so directly, as this code shows.

A_new = [-4.5 -0.05; 0.8 -12.0];
sys_dc.A = A_new;

See Also

| |

Related Examples

More About