| Contents | Index |
| On this page… |
|---|
Compensator Design Process Overview Beginning a Compensator Design Task |
Compensator design in the Control and Estimation Tools Manager involves the following steps:
Before you begin this compensator design example, close the Control and Estimation Tools Manager and the magball model, if you have them open, to make sure you are working with a fresh version of the magball model. You do not need to save any projects or any changes to the model.
To begin a new compensator design task for the magball model:
Enter magball at the MATLAB command line to open the magball model.
Select Tools > Control Design > Compensator Design from the magball window.
The Control and Estimation Tools Manager opens and creates a new compensator design task, as shown in the following figure.

The project tree in the left pane of the Control and Estimation Tools Manager now shows a Simulink Compensator Design Task node as part of Project - magball in addition to the Operating Points node. You can select a node within the tree to display its contents in the right pane.
For information on the Tunable Blocks pane within the Simulink Compensator Design Task node, refer to Selecting Blocks to Tune.
For information on the Closed-Loop Signals pane within the Simulink Compensator Design Task node, refer to Selecting Closed-Loop Responses to Design.
For information on the Operating Points node or the Operating Points pane within the Simulink Compensator Design Task node, refer to Selecting an Operating Point.
This section continues the magball example from Beginning a Compensator Design Task. At this stage in the example, you have already created a compensator design task.
In this step of the compensator design, you select the blocks in your model to tune from a list of tunable blocks in your model. Tunable blocks are blocks that you can tune using the SISO Design Tool to achieve the desired response of your system. Typically, these blocks serve as the compensators in your model.
In this example, you tune the compensator block called Controller inside the Controller subsystem of the magball model. To select this block as the block to tune:
Select the Simulink Compensator Design Task node.
In the Tunable Blocks pane, click Select Blocks. The Select Blocks to Tune dialog box opens.
Select the Controller subsystem in the left pane to display that subsystem's tunable blocks within the center pane. Within the center pane, select the check box next to the Controller block's name.

Click OK to apply your selections and close the dialog box.
You can tune parameters in the blocks shown in the following table using Simulink Control Design software. The block input and output signals for tunable blocks must have scalar, double-precision values.
| Tunable Blocks | Simulink Library |
|---|---|
| Math Operations | |
| Control System Toolbox | |
| Discrete | |
PID Controller (one-degree-of-freedom only) |
|
State-space blocks |
|
Zero-pole blocks |
|
Transfer function blocks |
|
You can also tune the following versions of the blocks listed in the table:
Blocks with custom configuration functions associated with a masked subsystem
Blocks discretized using the Simulink Model Discretizer
Note If your model contains Model blocks with normal-mode model references to other models, you can select tunable blocks in the referenced models for compensator design. |
When you have masked subsystems that you want to tune in your model, they will not automatically appear in the list of tunable blocks. For them to appear in the list, you need to create a custom configuration function for the masked subsystem. The custom configuration function serves the following functions:
It informs the Simulink Control Design software that you want this block to be available for tuning.
It determines how you want the SISO Design Task to treat the block; it describes the relationship between the block mask parameters and the poles and zeros of the transfer function.
To learn how to create a custom configuration function, see the Simulink Control Design demo "Tuning Custom Masked Subsystems".
This section continues the magball example from Selecting Blocks to Tune. At this stage in the example a compensator design task has been created, and tunable blocks have been selected.
In this step of the compensator design task, you will select the closed loops whose responses you want to design in your model. A closed-loop system is defined by an input point, such as a reference or disturbance signal, and an output point, such as a measured output or actuator signal.
In this example you will design the response of the closed-loop system from the reference signal to the output of the plant model. To set up linearization points to define this closed-loop system, perform the following steps:
On the magball model diagram, position the mouse on the Reference signal between the Desired Height block and the Sum block. Right-click and select Linearization Points > Input Point from the menu to add an input point.
Position the mouse on the signal line at the output of the Magnetic Ball Plant block. Right-click and select Linearization Points > Output Point from the menu to add an output point.
The magball model should now appear as follows:

Within the Control and Estimation Tools Manager, click the Closed-Loop Signals tab of the Simulink Compensator Design Task node to view the input and output points in the model.

Within this pane you can view the input and output signals in the model and use the Active column to select the ones you want to use to define closed-loop systems for compensator design.
This section continues the magball example from Selecting Closed-Loop Responses to Design. At this stage in the example, a compensator design task has been created, tunable blocks have been selected, and closed-loop signals have been selected.
In this step of the compensator design task, you will select the operating point that you want to use in the compensator design. The Simulink Control Design software uses the operating point when it linearizes the model before creating a SISO Design Task.
Note A compensator designed for the linearized model is likely to control the behavior of the nonlinear model only in a small region around the operating point that the model was linearized at. Therefore it is important that the linearization of the model is accurate and the selection of the operating point about which the system is linearized is an important step in the compensator design process. |
To import an operating point for compensator design, perform the following steps:
Select the Operating Points node in the Control and Estimation Tools Manager.
Click the Import button, in the bottom-right corner of the Control and Estimation Tools Manager.
In the Operating Point Import dialog box, select MAT-file as the location to import from.
Click Browse and locate the file magball_operating_point.mat that you previously saved. If you did not previously save an operating point, browse to matlabroot/toolbox/slcontrol/slctrldemos/magball_operating_point.mat.
Click Open to return to the Operating Point Import dialog box.
The Operating Point Import dialog box now shows all the operating points available within the selected MAT-file. In this case just a single operating point is contained in the MAT-file.

Select this operating point and click Import to import it into the Control and Estimation Tools Manager.
Click the Operating Points tab in the Simulink Compensator Design Task node to select an operating point for the compensator design. For this example, you should use the operating point that you just imported, called Operating_Point. To specify this operating point, first select the Linearize at one of the following operating points option. Then select Operating_Point in the list, as shown in the following figure.

This section continues the magball example from Selecting an Operating Point. At this stage in the example, a compensator design task has been created, and tunable blocks, closed-loop signals, and an operating point have been selected.
In this step of the compensator design task, you will create and configure a SISO Design Task in the Control and Estimation Tools Manager. The SISO Design Task includes several tools for tuning the response of SISO systems:
A graphical editing environment in the SISO Design Tool window that contains design plots such as root-locus, and Bode diagrams
An LTI Viewer window where you can view time and frequency analysis plots of the system
A compensator editor where you can directly edit the block mask parameters or the poles and zeros of compensators in your system
A tool that automatically generates compensators using PID, internal model control (IMC), or linear-quadratic-Gaussian (LQG) methods (uses the Control System Toolbox software)
Optimization-based tuning methods that automatically tunes the system to satisfy design requirements (available when you have the Simulink Design Optimization product)
The Design Configuration Wizard guides you through the selection of the open- and closed-loop systems you want to design and the configuration of the design and analysis plots you want to use in the SISO Design Task. To launch the wizard, click Tune Blocks in the Simulink Compensator Design Task node. The wizard opens in a separate window.
The first page of the wizard provides an overview of the design configuration process and lists some issues to consider when selecting design and analysis plots. Click Next to continue to step 1 of the design configuration process on the second page of the wizard.
In step 1, select the open- and closed-loop systems that you want to design in your model, and up to six corresponding design plots you want to use.
Open-loop design allows you to design the response of a closed feedback loop in your model by artificially opening the loop and designing the response of this open-loop system. The open-loop design plots use rules of linear control theory to determine the dynamics of the closed-loop system from those of the open-loop system. Open-loop design is typically used to tune compensators that lie inside feedback loops.
A set of default open-loop systems is created for your model, shown in the lower half of the wizard. To create these open-loop systems, the software artificially opens the feedback loop at the output signal of each tunable block (at the X in the following figure) and unwraps the closed-loop system to create the corresponding open-loop system.

The unwrapped open-loop system, which is -CPH, is shown in the following figure. The open-loop design plots show the negative of the unwrapped open-loop, which is CPH. This configuration allows you to design controllers using a negative feedback architecture.
![]()
Note that elements that are outside the feedback loop, such as the prefilter F, are not seen in the open-loop system.
In this example, you will tune the response of Open Loop 1 which is defined by a loop opening at the output of the Controller block. This open-loop system contains the plant model and the controller. To design this system, select Open Loop 1 from the menu next to Plot 1 in the wizard.
Next, select a design plot to use for this open-loop system. Design plots are interactive plots within the SISO Design Tool. You can use them to graphically tune parameters and manually move, add, or remove poles and zeros of the tunable blocks to tune and design the dynamics of open- and closed-loop systems in your model. The following table shows the design plots, along with their uses, available in the SISO Design Tool.
| Type of Design Plot | Available Plots in the SISO Design Tool | Use to tune blocks that act as |
|---|---|---|
| Open-loop | Root Locus, Nichols, Open-loop bode | Feedback elements |
| Closed-loop | Closed-loop bode | Feedforward or prefilter elements |
You can also use the design plots to specify requirements for stability, performance, or both to use in using optimization-based automated tuning.
For this example, select Root Locus from the menu next to Plot 1 to use this plot type as the design plot for Open Loop 1. Step 1 of the wizard should now look similar to the following figure.

Click Next to proceed to step 2 of the wizard.
In this step, select the closed-loop responses that you want to view while designing your model, and the corresponding analysis plots you want to use to view them.
Analysis plots are plots that show the responses or dynamics of a closed or open loop systems or tunable blocks in your model. Although you cannot directly edit the analysis plots by graphically moving gains, poles, zeros, etc., changes that you make in the design plots, compensator editor, or automated design tools will affect the responses in the analysis plots. Possible analysis plots include
Step response
Impulse response
Bode and Bode magnitude
Nyquist
Nichols
Pole/Zero
You can use analysis plots to
Analyze closed-loop, open-loop, and tuned block responses in your control system.
Define stability and performance requirements for optimization-based automated tuning.
For this example, select Step from the menu for Plot 1 to create a step response analysis plot.
Next, select the closed-loop system that you want to display in this plot. A closed-loop system is a system that has not had any feedback loops opened for open-loop design. It typically defines the system whose response you want to control and it lies between the input and output signals of interest, for example between a reference signal and the plant output signal.
Linearization input and output points placed on signal lines in your model define closed-loop systems. The closed-loop system includes all blocks in the path between the input and the output.

The software automatically displays a list of up to four closed-loop systems in your model, based on the input and output points on the signal lines. In this example, only one closed-loop system appears in the wizard, the closed-loop from the Desired Height signal to the output of the Magnetic Ball Plant Model, because the system only has one input and one output point. You can add additional closed-loop responses, as well as open-loop and tunable block responses. To add a new response, click the Add Responses button and complete the Select a New Response to Analyze dialog box.
To display the current closed-loop system in the step response plot of Plot 1, select the check box under Plot 1 to the left of the closed-loop system. Step 2 of the wizard should now look similar to the following figure.

Click Finish to complete the wizard and create the SISO Design Task underneath the Simulink Compensator Design Task node within the Control and Estimation Tools Manager, as shown in the following figure.

The SISO Design Task also includes the design plots you configured in the Design Configuration Wizard. They appear within the SISO Design Tool window, as shown in the following figure.

In addition, the SISO Design Task also includes the analysis plots you configured in the Design Configuration Wizard. They appear within the LTI Viewer window, as shown in the following figure.

To modify or adjust the settings used to linearize a model when creating a SISO Design Task, click the Simulink Compensator Design Task node, and then select Tools > Options. The Options dialog box opens.

Specify the linearization sample time and rate conversion method. If, for the Rate conversion method parameter, you specify Tustin W/Prewarping, you must also specify a pre-warp frequency.
You can design compensators for plants with time delays using the tools in the SISO Design Task. These tools automatically create a linear model of your plant. Within this model, you can represent time delays in two ways—using Padé approximation or exact delay.
| To represent time delays in the linear plant model using... | You must... |
|---|---|
| Padé approximation representations | Specify the Padé order in the Block Parameters window for each Simulink blocks with delays. |
| Exact delay representations | Open the Simulink Compensator Design Task, and select Tools > Options. Then, in the Options dialog box, select Enable design of linearized control systems with exact delay(s). |
Note Some tools do not support exact time delays and automatically compute a Padé approximation for delays. In this case, you receive a notification. The software uses the Padé order specified in SISO Tool Preferences and ignores the Padé order specified in your block. For more information, see Time Delays Pane. |
For more information on the linearizing models with time delays, see Models With Time Delays. For more information on the tools available for compensator design, see Tools for Compensator Design.
This section continues the magball example from Creating a SISO Design Task. At this stage in the example, a compensator design task has been created, tunable blocks, closed-loop signals, and an operating point have been selected, design and analysis plots have been created, and a SISO Design Task node has been created in the Control and Estimation Tools Manager.
In this step of the compensator design task, you will complete the design of the compensator in the magball model, using the SISO Design Task node. For a more detailed discussion of the SISO Design Task node, refer to the Control System Toolbox documentation.
The SISO Design Task node contains five panes with various tools for designing the compensators in your system.
Architecture:
Configure loops for multi-loop design by opening signals to remove the effects of other feedback loops.
Import compensators into your system.
Convert the sample time of the system or switch between different sample times to design different compensators.
Compensator Editor:
Directly edit the poles, zeros, and gains of the compensator.
Add or remove poles and zeros to the compensators.
Graphical Tuning:
Configure design plots in the SISO Design Tool.
Use design plots to graphically manipulate the response of the system.
Analysis Plots:
Configure analysis plots in the LTI Viewer.
Use analysis plots to view the response of open- or closed-loop systems.
Automated Tuning: Design compensators using one of several automated methods.
Automatically generate compensators using PID, internal model control (IMC), or linear-quadratic-Gaussian (LQG) methods (uses Control System Toolbox software).
Use optimization-based methods that automatically tune the system to satisfy design requirements (available when you have the Simulink Design Optimization product).
You can use any of these design methods, or a combination of methods, to design the compensators for your system. A suitable final design for the Controller of the magball model is:
Gain: -16000
Integrator at the origin
Complex zeros at -10±10i
Real pole at -1000
You can use the Compensator Editor in the SISO Design Task node to specify these settings. The initial design contains an integrator at the origin. Specify the remaining settings as follows:
Gain — Enter -16000 in the text box to the right of the equal sign in the Compensator area.
Complex zeros — In the Dynamics table, right-click and then select Add Pole/Zero > Complex Zero. Select the new complex zero in the Dynamics table. In the Edit Selected Dynamics table:
Enter -10 in the Real Part field.
Enter 10 in the Imaginary Part field.
Real pole — In the Dynamics table, right-click and then select Add Pole/Zero > Real Pole. Select the new real pole in the Dynamics table. In the Edit Selected Dynamics table:
Enter -1000 in the Location field.
The Control and Estimation Tools Manager should now appear similar to the following:

With these settings, the root-locus diagram and step-response plot should look similar to the following figure.


When you design a compensator within a Simulink Compensator Design Task, you can store the current design. You can retrieve the stored design at any time. This storage and retrieval capability lets you continue designing and still be able to return to a previously saved version of the design.
This section continues the example from Completing the Design. At this stage in the example, a compensator has been designed to control the system. To store the design within the SISO Design Task node, perform the following steps:
Select the SISO Design Task node in the Control and Estimation Tools Manager.
Underneath the SISO Design Task panes, click the Store Design button.
Clicking this button adds the current design to the Design History node as shown in the following figure. The default name for the design is Design.

To rename the design to something more descriptive:
Right-click the Design node underneath the Design History node.
Select Rename from the right-click menu.
Enter a name for your design. For this example, call the design Magball Design.
The Control and Estimation Tools Manager should now appear as follows:

Note After you store a compensator design, you can continue to refine it. If you make undesired changes, you can retrieve the stored design by selecting it in the Design History node and then clicking the Retrieve Design button. |
When designing a compensator within a Simulink Compensator Design Task node, you can write the compensator design to the Simulink model. This is useful when
You want to see how the current design performs in the full nonlinear model.
You have completed the design and you want to update the model with the newly designed parameters.
When you write the compensator design to your Simulink model:
If the block parameters are numerical, the software writes new numerical values to the tuned block.
If the block parameters are variables in the base workspace or the model workspace (including Simulink.Parameter objects), the software writes the tuned values to those variables. The block parameters remain the workspace variables.
There are two ways to write the design to your Simulink model:
Write the tuned parameters to your model when you have finished your design — Click the Design node of the Control and Estimation Tools Manager and click the Update Simulink Block Parameters button.
Automatically update the block parameters as you tune the design — select the Design History node in the Control and Estimation Tools Manager and click the checkbox next to Automatically update block parameters.
For example, continue the example from Storing and Retrieving Designs. At this stage in the example you have designed a compensator to control the system and stored the design within the SISO Design Task node. To write the stored design to the magball model, perform the following steps:
Select the Magball Design node under the Design History node in the Control and Estimation Tools Manager.
Click the Update Simulink Block Parameters button.
You can now simulate the magball model containing the newly designed Controller block. For more information on simulating models, see Running Simulations in the Simulink documentation.
After simulation, the Scope block of the magball model should look similar to the following figure.

The system is now stable and the height of the magnetic ball settles at the desired height of 0.05 m.
The SISO Design Task is a graphical user interface (GUI) that simplifies the task of designing controllers. This section describes the similarities and differences between the SISO Design Task, which is available in the Control System Toolbox product, and the enhanced SISO Design Task, which is available with the Simulink Control Design product.
The following figure shows the SISO Design Task as it appears in the Control and Estimation Tools Manager.

The following figure shows the enhanced SISO Design Task as it appears under the Simulink Compensator Design Task node in the Control and Estimation Tools Manager.

The following table summarizes the similarities and differences between the SISO Design Task and the enhanced SISO Design Task:
| Similarities | Differences |
|---|---|
|
|
For additional information, see:
Designing Compensators in the Control System Toolbox getting started documentation
SISO Design Tool in the Control System Toolbox getting started documentation
The Design Operating Point node is located inside the Design History node of the Control and Estimation Tools Manager.

The States pane describes the operating point the GUI used to linearize the model. When creating the SISO Design Task node, you can use this pane to import a different operating point and to populate the SISO Design Task node with a linear model evaluated at the new operating point.
To modify the precision of the numbers calculated by SISO Tool, click the SISO Design Task node, and then select Tools > Options. The SISOTool Options dialog box opens.

If you select the Use full precision check box, the SISO Tool uses the full double-precision data type when writing back to the Simulink block dialog box. If you clear this check box, use Custom: n digits of precision to specify the precision you want.
For additional information, see Creating a SISO Design Task.
![]() | Automatic PID Tuning | Model Verification | ![]() |

Learn more about resources for designing, testing, and implementing control systems.
Get free kit| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |