Main Content

Construct Linear Time Invariant Models

Model Predictive Control Toolbox™ software supports the same LTI model formats as does Control System Toolbox™ software. You can use whichever is most convenient for your application and convert from one format to another. For more details, see Basic Models.

Transfer Function Models

A transfer function (TF) relates a particular input/output pair. For example, if u(t) is a plant input and y(t) is an output, the transfer function relating them might be:


This TF consists of a numerator polynomial, s+2, a denominator polynomial, s2+s+10, and a delay, which is 1.5 time units here. You can define G using Control System Toolbox tf function:

Gtf1 = tf([1 2], [1 1 10],'OutputDelay',1.5)
Transfer function:
                 s + 2
exp(-1.5*s) * ------------
              s^2 + s + 10

Zero/Pole/Gain Models

Like the TF format, the zero/pole/gain (ZPK) format relates an input/output pair. The difference is that the ZPK numerator and denominator polynomials are factored, as in


(zeros and/or poles are complex numbers in general).

You define the ZPK model by specifying the zero(s), pole(s), and gain as in

poles = [-0.3, -0.1+0.7*i, -0.1-0.7*i];
Gzpk1 = zpk(-0.45,poles,2.5);

State-Space Models

The state-space format is convenient if your model is a set of LTI differential and algebraic equations. For example, consider the following linearized model of a continuous stirred-tank reactor (CSTR) involving an exothermic (heat-generating) reaction [1].



where CA is the concentration of a key reactant, T is the temperature in the reactor, Tc is the coolant temperature, CAi is the reactant concentration in the reactor feed, and aij and bij are constants. See the process schematic in CSTR Schematic. The primes (e.g., CA) denote a deviation from the nominal steady-state condition at which the model has been linearized.

CSTR Schematic

Measurement of reactant concentrations is often difficult, if not impossible. Let us assume that T is a measured output, CA is an unmeasured output, Tc is a manipulated variable, and CAi is an unmeasured disturbance.

The model fits the general state-space format






The following code shows how to define such a model for some specific values of the aij and bij constants:

A = [-0.0285  -0.0014
     -0.0371  -0.1476];
B = [-0.0850   0.0238
      0.0802   0.4462];
C = [0 1
     1 0];
D = zeros(2,2);
CSTR = ss(A,B,C,D);

This defines a continuous-time state-space model. If you do not specify a sampling period, a default sampling value of zero applies. You can also specify discrete-time state-space models. You can specify delays in both continuous-time and discrete-time models.


In the CSTR example, the D matrix is zero and the output does not instantly respond to change in the input. The Model Predictive Control Toolbox software prohibits direct (instantaneous) feedthrough from a manipulated variable to an output. For example, the CSTR model could include direct feedthrough from the unmeasured disturbance, CAi, to either CA or T but direct feedthrough from Tc to either output would violate this restriction. If the model had direct feedthrough from Tc, you can add a small delay at this input to circumvent the problem.

LTI Object Properties

The ss function in the last line of the above code creates a state-space model, CSTR, which is an LTI object. The tf and zpk commands described in Transfer Function Models and Zero/Pole/Gain Models also create LTI objects. Such objects contain the model parameters as well as optional properties.

LTI Properties for the CSTR Example

The following code sets some of the CSTR model's optional properties:

CSTR.InputName = {'T_c','C_A_i'};
CSTR.OutputName = {'T','C_A'};
CSTR.StateName = {'C_A','T'};
CSTR.InputGroup.MV = 1;
CSTR.InputGroup.UD = 2;
CSTR.OutputGroup.MO = 1;
CSTR.OutputGroup.UO = 2;

The first three lines specify labels for the input, output and state variables. The next four specify the signal type for each input and output. The designations MV, UD, MO, and UO mean manipulated variable, unmeasured disturbance, measured output, and unmeasured output. (See Signal Types for definitions.) For example, the code specifies that input 2 of model CSTR is an unmeasured disturbance. The last line causes the LTI object to be displayed, generating the following lines in the MATLAB® Command Window:

A = 
            C_A        T
   C_A  -0.0285  -0.0014
   T    -0.0371  -0.1476
B = 
           T_c    C_Ai
   C_A  -0.085  0.0238
   T    0.0802  0.4462

C = 
        C_A    T
   T      0    1
   C_A    1    0
D = 
         T_c  C_Ai
   T       0     0
   C_A     0     0
Input groups:       
    Name    Channels
     MV        1    
     UD        2    
Output groups:      
    Name    Channels
     MO        1    
     UO        2    
Continuous-time model

Input and Output Names

The optional InputName and OutputName properties affect the model displays, as in the above example. The software also uses the InputName and OutputName properties to label plots and tables. In that context, the underscore character causes the next character to be displayed as a subscript.

Input and Output Types

General Case.  As mentioned in Signal Types, Model Predictive Control Toolbox software supports three input types and two output types. In a Model Predictive Control Toolbox design, designation of the input and output types determines the controller dimensions and has other important consequences.

For example, suppose your plant structure were as follows:

Plant Inputs

Plant Outputs

Two manipulated variables (MVs)

Three measured outputs (MOs)

One measured disturbance (MD)

Two unmeasured outputs (UOs)

Two unmeasured disturbances (UDs)


The resulting controller has four inputs (the three MOs and the MD) and two outputs (the MVs). It includes feedforward compensation for the measured disturbance, and assumes that you wanted to include the unmeasured disturbances and outputs as part of the regulator design.

If you didn't want a particular signal to be treated as one of the above types, you could do one of the following:

  • Eliminate the signal before using the model in controller design.

  • For an output, designate it as unmeasured, then set its weight to zero.

  • For an input, designate it as an unmeasured disturbance, then define a custom state estimator that ignores the input.


    By default, the software assumes that unspecified plant inputs are manipulated variables, and unspecified outputs are measured. Thus, if you didn't specify signal types in the above example, the controller would have four inputs (assuming all plant outputs were measured) and five outputs (assuming all plant inputs were manipulated variables).

For model CSTR, the default Model Predictive Control Toolbox assumptions are incorrect. You must set its InputGroup and OutputGroup properties, as illustrated in the above code, or modify the default settings when you load the model into MPC Designer.

Use setmpcsignals to make type definition. For example:

CSTR = setmpcsignals(CSTR,'UD',2,'UO',2);

sets InputGroup and OutputGroup to the same values as in the previous example. The CSTR display would then include the following lines:

Input groups:              
       Name        Channels
    Unmeasured        2    
    Manipulated       1    

Output groups:             
       Name       Channels 
    Unmeasured       2     
     Measured        1     

Notice that setmpcsignals sets unspecified inputs to Manipulated and unspecified outputs to Measured.

LTI Model Characteristics

Control System Toolbox software provides functions for analyzing LTI models. Some of the more commonly used are listed below. Type the example code at the MATLAB prompt to see how they work for the CSTR example.


Intended Result


Calculate gain matrix for the CSTR model's input/output pairs.


Graph CSTR model's unit-impulse response.


Open the Linear System Analyzer with the CSTR model loaded. You can then display model characteristics by making menu selections.


Calculate CSTR model's poles (to check stability, etc.).


Graph CSTR model's unit-step response.


Compute CSTR model's transmission zeros.


[1] Seborg, D. E., T. F. Edgar, and D. A. Mellichamp, Process Dynamics and Control, 2nd Edition, Wiley, 2004, pp. 34–36 and 94–95.

See Also

| | |

Related Topics