MATLAB Examples

Model objects can represent individual components of a control architecture, such as the plant, actuators, sensors, or controllers. You can connect model objects to build aggregate

This case study illustrates Kalman filter design and simulation. Both steady-state and time-varying Kalman filters are considered.

Use command-line PID tuning options to reduce overshoot in reference tracking or to improve rejection of a disturbance at the plant input. Using the pidtune command, the example

Design a two-degree-of-freedom (2-DOF) PID controller at the command line. The example also compares the 2-DOF controller performance to the performance achieved with a 1-DOF PID

Use Simulink Control Design to tune a two-loop autopilot controlling the pitch rate and vertical acceleration of an airframe.

Use Control System Toolbox™ to design a digital servo controller for a disk drive read/write head.

Use slTuner and systune to tune the current and velocity loops in a linear electric actuator with saturation limits.

The limitations of PI control for processes with long dead time and illustrates the benefits of a control strategy called "Smith Predictor."

Design a compensator for a plant model defined by frequency response data (FRD) using Control System Designer.

Tune a controller for reducing vibrations in a flexible beam.

Use the Control System Tuner app to tune a MIMO, multiloop control system modeled in Simulink.

Uses systune to control an inverted pendulum on a cart.

Configure Control System Designer from the command line and how to create functions to customize the startup of a Control System Designer session.

Uses systune to generate smooth gain schedules for a three-loop autopilot.

Tune compensators for a feedback control system using Control System Designer .

Design feedback and feedforward compensators to regulate the temperature of a chemical reactor through a heat exchanger.

Design and analyze a controller for multiple plant models using Control System Designer.

Uses systune to design and tune a MIMO controller for a Diesel engine. The controller is tuned in discrete time for a single operating condition.

Leverage the Parallel Computing Toolbox™ to accelerate multi-start strategies for tuning fixed-structure control systems.

The design of a YAW DAMPER for a 747® aircraft using the classical control design features in Control System Toolbox™.

Use Control System Toolbox™ to tune a digital motion control system.

Perform Kalman filtering. Both a steady state filter and a time varying filter are designed and simulated below.

The design of a non-inverting feedback amplifier circuit using Control System Toolbox™. This design is built around the operational amplifier (op amp), a standard building block of

In this example, you learn how to use Control System Tuner app to design a controller for a nonlinear plant modeled in Simulink. You accomplish the following tasks:

Convert a discrete-time system to continuous time using d2c , and compares the results using two different interpolation methods.

Absorbing time delays into frequency response data can cause undesirable phase wrapping at high frequencies.

To reduce the order of a model by pole-zero cancellation at the command line, use minreal .

Convert a time delay in a discrete-time model to factors of 1/_z_.

Create a two-dimensional (2-D) array of transfer functions using for loops. One parameter of the transfer function varies in each dimension of the array.

Compute a reduced-order approximation of a system when the system has unstable or near-unstable poles.

Obtain the closed-loop response of a MIMO feedback loop in three different ways.

Compute a low-order approximation in two ways and compares the results. When you compute a low-order approximation by the balanced truncation method, you can either:

Convert a compensator from continuous to discrete time using several discretization methods, to identify a method that yields a good match in the frequency domain.

Insert multichannel analysis points in a generalized state-space model of a MIMO control system.

Build a block diagram and insert analysis points at locations of interest using the connect command. You can then use the analysis points to extract various system responses from the model.

Extract SISO control components from a 2-DOF PID controller in each of the feedforward, feedback, and filter configurations. The example compares the closed-loop systems in all

Query model characteristics such as stability, time domain, and number of inputs and outputs. You can use the techniques of this example on any type of dynamic system model.

Query the size of model arrays, including the number of inputs and outputs of the models in the array, and the array dimensions. It also shows how to query characteristics of the models in the

Proper scaling of state-space models can be critical for accuracy and provides an overview of automatic and manual rescaling tools.

Construct a Linear Parameter Varying (LPV) representation of a system that exhibits multi-mode dynamics.

Focusing the energy-contribution calculation on a particular frequency region sometimes yields a good approximation to the dynamics of interest at a lower order than a reduction that

Sample a parametric model of a second-order filter across a grid of parameter values using sampleBlock .

Use the commands for continuous/discrete, discrete/continuous, and discrete/discrete conversions.

How the Control System Toolbox™ lets you represent, manipulate, and analyze any LTI model with a finite number of delays. The delays can be at the system inputs or outputs, between specific

Create a parametric model of the second-order filter:

Create a tunable model of the control system in the following illustration.

How choice of model type can affect numerical accuracy when interconnecting models.

Compute and plot the response of a state-space ( ss ) model to specified initial state values using initial .

Examine the effect of stability margins on closed-loop response characteristics of a control system.

Use Control System Toolbox™ to analyze and design control systems with delays.

Analyze the time and frequency responses of common RLC circuits as a function of their physical parameters using Control System Toolbox™ functions.

Passive control is often part of the safety requirements in applications such as process control, tele-operation, human-machine interfaces, and system networks. A system is passive if it

In its simplest form, a conic sector is the 2-D region delimited by two lines, y=au and y=bu .

Obtain a step-response plot and step-response data for a discrete-time dynamic system model. Obtaining time-domain responses of discrete-time models is the same as for continuous-time

Obtain numeric values of step response characteristics such as rise time, settling time, and overshoot using stepinfo . You can use similar techniques with lsiminfo to obtain

Obtain step and impulse response data, as well as step and impulse response plots, from a dynamic system model.

Examine the pole and zero locations of dynamic systems both graphically using pzplot and numerically using pole and zero .

Compute various measures of passivity for linear time-invariant systems.

Illustrates the properties of a parallel interconnection of passive systems.

Plot the frequency response and obtain frequency response data for a single-input, single-output (SISO) dynamic system model.

Obtain numeric values of several frequency-domain characteristics of a SISO dynamic system model, including the peak gain, dc gain, system bandwidth, and the frequencies at which the

Examine the frequency response of a multi-input, multi-output (MIMO) system in two ways: by computing the frequency response, and by computing the singular values.

Illustrates the properties of a series interconnection of passive systems.

Illustrates the properties of a feedback interconnection of passive systems.

Change the units of a Bode plot from rad/s to Hz.

Obtain impulse response data and plots for a multi-input, multi-output (MIMO) model using impulse . You can use the same techniques to obtain other types of time-domain responses of MIMO

Examine the sensitivity of a closed-loop control system to time delays within the system.

Compare the step responses of multiple models on a single plot using step . This example compares the step response of an uncontrolled plant to the closed-loop step response of the plant with

Enforce absolute stability when a linear time-invariant system is in feedback interconnection with a static nonlinearity that belongs to a conic sector.

Most PID tuning rules are based on the assumption that the plant can be approaximated by a first-order plus time delay system. This code explains why this assumption is valid and how to

Most PID tuning rules are based on first-order plus time delay assumption of the plant hence cannot ensure the best control performance. Using mordern optimization techniques, it is

The PID controller is the most widely used controller in various engineering systems. However, appropriately tuning a PID controller is not an easy task althrough it has only three

Copyright 2010-2012, The MathWorks, Inc. All rights reserved.

State Space MPC code.

The following example illustrate the change in peak time, settling time and percent overshoot as the poles of a 2nd order system move horizontaly, vertically and with fixed angle on the

This demo is uses MATLAB to develop and test a simple trading strategy using an exponential moving average.

This demo is an introduction to using MATLAB to develop a simple trading strategy using an exponential moving average.

This demo expands on the previous demo to incorporate a larger, intraday trading set (loaded from a database). More data implies more calculations, so we use Parallel Computing Toolbox to

This demo shows how functionality within Econometric Toolbox can be used to identify and calibrate a simple, intraday pairs trading strategy.

Illustrates the steps involved in integrating MATLAB and QuickFIX/J

Previously, we developed a back testing framework to calibrate a simple trading strategy to intraday data. In this demo we'll use extend the approach to three signals: MA, RSI, and Williams

Show how to set up a listener and callback for a change in price. Note that X_Trader is a 32-bit application and will only work with 32-bit Windows installations of MATLAB.

Simulation of Multiple-Mass Dynamic System

This is a simple demonstration to highlight making use of .NET Assemblies directly in MATLAB.

Authors: M. A. Rafe Biswas, Samuel Ogletree, Shan Mohammed

This example was authored by the MathWorks community.

Populates a table with market depth information as the prices update. Note that X_Trader is a 32-bit application and will only work with 32-bit Windows installations of MATLAB.

Create an order and submit it. Note that X_Trader is a 32-bit application and will only work with 32-bit Windows installations of MATLAB.

Plot the time and frequency responses of SISO and MIMO linear systems.

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

Contact your local office