034IN "Fundamentals of Automatic Control" - Introduction to MATLAB Part 6 - LTI Systems
This is the sixth MATLAB live script of the collection 034IN "Fundamentals of Automatic Control" - Introduction to MATLAB, devoted to introducing the MATLAB environment and tools for solving practical problems related to the topics of the 034IN course, i.e., performance analysis of dynamic systems, design of control law for continuous-time linear dynamical systems, approximate discretization of a continuous-time control law, etc.
Use this link to go back to the main live script of the collection.
Objectives
The aim of this module is to understand how to create and manipulate LTI systems in MATLAB.
Time Invariant Linear Dynamic Systems
AN LTI system can be described
- using a state-space description
- using the transfer function matrix for a MIMO system or a single transfer function for a SISO system
In MATLAB, it is possible to define a linear time-invariant dynamical system as an object of type numLTI model from any of these descriptions (use help numlti for details ). Using these MATLAB objects, it is possible to analyze the properties of the corresponding dynamic system, and also to simulate the evolution of the dynamic system over time with assigned initial conditions and inputs.
From now on, for simplicity, we only consider SISO systems.
LTI-System Object from the State-Space Description
Starting from the state equation, you can
- define the matrices A, B, C, D of the state equations in the MATLAB workspace;
- define the LTI system by means of the command ss
help ss
ss - State-space model
Use ss to create real-valued or complex-valued state-space models, or to
convert dynamic system models to state-space model form.
Creation
Syntax
sys = ss(A,B,C,D)
sys = ss(A,B,C,D,ts)
sys = ss(A,B,C,D,ltiSys)
sys = ss(D)
sys = ss(___,Name,Value)
sys = ss(ltiSys)
sys = ss(ltiSys,component)
sys = ss(ssSys,'minimal')
sys = ss(ssSys,'explicit')
Input Arguments
A - State matrix
Nx-by-Nx matrix
B - Input-to-state matrix
Nx-by-Nu matrix
C - State-to-output matrix
Ny-by-Nx matrix
D - Feedthrough matrix
Ny-by-Nu matrix
ts - Sample time
scalar
ltiSys - Dynamic system to convert to state-space form
dynamic system model | model array
component - Component of identified model
'measured' (default) | 'noise' | 'augmented'
ssSys - Dynamic system model to convert to minimal realization or explicit form
ss model object
Output Arguments
sys - Output system model
ss model object | genss model object | uss model object
Properties
A - State matrix
Nx-by-Nx matrix
B - Input-to-state matrix
Nx-by-Nu matrix
C - State-to-output matrix
Ny-by-Nx matrix
D - Feedthrough matrix
Ny-by-Nu matrix
E - Matrix for implicit state-space models
[] (default) | Nx-by-Nx matrix
Offsets - Model offsets
[] (default) | structure
Scaled - Logical value indicating whether scaling is enabled or disabled
0 (default) | 1
StateName - State names
' ' (default) | character vector | cell array of character vectors
StatePath - State path
' ' (default) | character vector | cell array of character vectors
StateUnit - State units
' ' (default) | character vector | cell array of character vectors
InternalDelay - Internal delays in the model
vector
InputDelay - Input delay
0 (default) | scalar | Nu-by-1 vector
OutputDelay - Output delay
0 (default) | scalar | Ny-by-1 vector
Ts - Sample time
0 (default) | positive scalar | -1
TimeUnit - Time variable units
'seconds' (default) | 'nanoseconds' | 'microseconds' |
'milliseconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'months' |
'years' | ...
InputName - Input channel names
'' (default) | character vector | cell array of character vectors
InputUnit - Input channel units
'' (default) | character vector | cell array of character vectors
InputGroup - Input channel groups
structure
OutputName - Output channel names
'' (default) | character vector | cell array of character vectors
OutputUnit - Output channel units
'' (default) | character vector | cell array of character vectors
OutputGroup - Output channel groups
structure
Name - System name
'' (default) | character vector
Notes - User-specified text
{} (default) | character vector | cell array of character vectors
UserData - User-specified data
[] (default) | any MATLAB data type
SamplingGrid - Sampling grid for model arrays
structure array
Object Functions
prescale - Optimal scaling of state-space models
ssbal - Scale state/uncertainty while preserving uncertain input/output map of uncertain system
estim - Form state estimator given estimator gain
kalman - Design Kalman filter for state estimation
kalmd - Design discrete Kalman estimator for continuous plant
lqg - Linear-Quadratic-Gaussian (LQG) design
lqgreg - Form linear-quadratic-Gaussian (LQG) regulator
lqgtrack - Form Linear-Quadratic-Gaussian (LQG) servo controller
lqi - Linear-Quadratic-Integral control
lqr - Linear-Quadratic Regulator (LQR) design
lqry - Form linear-quadratic (LQ) state-feedback regulator with output weighting
reg - Form regulator given state-feedback and estimator gains
totaldelay - Total combined I/O delays for LTI model
balancmr - (Not recommended) Balanced model truncation via square root method
bilin - Multivariable bilinear transform of frequency (s or z)
dcgainmr - (Not recommended) Reduced order model
hankelmr - (Not recommended) Hankel minimum degree approximation (MDA) without balancing
hankelsv - (Not recommended) Compute Hankel singular values for stable/unstable or continuous/discrete system
ltiarray2uss - Compute uncertain system bounding given LTI ss array
schurmr - (Not recommended) Balanced model truncation via Schur method
sectf - State-space sector bilinear transformation
absorbDelay - Replace time delays by poles at z = 0 or phase shift
bode - Bode frequency response of dynamic system
bodemag - Magnitude-only Bode plot of frequency response
c2d - Convert model from continuous to discrete time
canon - (Not recommended) Canonical state-space realization
chgTimeUnit - Change time units of dynamic system
connect - Block diagram interconnections of dynamic systems
d2c - Convert model from discrete to continuous time
d2d - Resample discrete-time model
dcgain - Low-frequency (DC) gain of LTI system
delay2z - Replace delays of discrete-time TF, SS, or ZPK models by poles at z=0, or replace delays of FRD models by phase shift
evalfr - Evaluate system response at specific frequency
findop - Compute operating condition from specifications
impulse - Impulse response plot of dynamic system; impulse response data
interp - Interpolate FRD model
iopzmap - Plot pole-zero map for input-output pairs of dynamic system using default options
isct - Determine if dynamic system model is in continuous time
isdt - Determine if dynamic system model is in discrete time
isproper - Determine if dynamic system model is proper
isstable - Determine if dynamic system model is stable
lsim - Compute time response simulation data of dynamic system to arbitrary inputs
nyquist - Nyquist response of dynamic system
order - Query model order
pole - Poles of dynamic system
pzmap - Pole-zero map of dynamic system
repsys - Replicate and tile models
set - Set or modify model properties
ssdata - Access state-space model data
step - Step response of dynamic system
tfdata - Access transfer function data
zero - Zeros and gain of SISO dynamic system
zpkdata - Access zero-pole-gain data
allmargin - Gain margin, phase margin, delay margin, and crossover frequencies
bandwidth - Frequency response bandwidth
covar - Output and state covariance of system driven by white noise
damp - Natural frequency and damping ratio
getGainCrossover - Crossover frequencies for specified gain
getPassiveIndex - Compute passivity index of linear system
getPeakGain - Peak gain of dynamic system frequency response
getSectorCrossover - Crossover frequencies for sector bound
getSectorIndex - Compute conic-sector index of linear system
initial - System response to initial states of state-space model
isPassive - Check passivity of linear systems
margin - Gain margin, phase margin, and crossover frequencies
nichols - Nichols response of dynamic system
norm - Norm of linear model
passiveplot - Compute or plot passivity index as function of frequency
sectorplot - Compute or plot sector index as function of frequency
sigma - Singular values of frequency response of dynamic system
stepinfo - Rise time, settling time, and other step-response characteristics
tzero - Invariant zeros of linear system
looptune - Tune fixed-structure feedback loops
looptuneSetup - Convert tuning setup for looptune to tuning setup for systune
loopview - Graphically analyze MIMO feedback loops
pidtune - PID tuning algorithm for linear plant model
rlocus - Root locus of dynamic system
systune - Tune fixed-structure control systems modeled in MATLAB
balreal - Balanced state-space realization
dssdata - Extract descriptor state-space data
fixInput - Fix value of some inputs and delete them
freqsep - Slow-fast decomposition
getDelayModel - State-space representation of internal delays
mechssdata - Access second-order sparse state-space model data
minreal - Minimal realization or pole-zero cancellation
modalsep - Compute modal decomposition
piddata - Access coefficients of parallel-form PID controller
piddata2 - Access coefficients of parallel-form 2-DOF PID controller
pidstddata - Access coefficients of standard-form PID controller
pidstddata2 - Access coefficients of standard-form 2-DOF PID controller
setDelayModel - Construct state-space model with internal delays
sparssdata - Access first-order sparse state-space model data
spectralfact - Spectral factorization of linear systems
stabsep - Stable-unstable decomposition
upsample - Upsample discrete-time models
balred - (Not recommended) Model order reduction
hsvd - (Not recommended) Hankel singular values of dynamic system
hsvplot - (Not recommended) Plot Hankel singular values
dksynperf - (Not recommended) Robust H_{∞} performance optimized by dksyn
loopmargin - (Not recommended) Stability margin analysis of LTI and Simulink feedback loops
mktito - Partition LTI system into two-input/two-output system
modreal - (Not recommended) Modal form realization and projection
ncfmr - (Not recommended) Model reduction from normalized coprime factorization
wcmargin - (Not recommended) Worst-case disk stability margins of uncertain feedback loops
wcsens - (Not recommended) Calculate worst-case sensitivity and complementary sensitivity functions of plant-controller feedback loop
augw - Plant augmentation for weighted mixed-sensitivity H_{∞} and H_{2} loop-shaping design
bstmr - (Not recommended) Balanced stochastic model truncation (BST) via Schur method
diskmargin - Disk-based stability margins of feedback loops
diskmarginplot - Visualize disk-based stability margins
gapmetric - Gap metric and Vinnicombe (nu-gap) metric for distance between two systems
h2hinfsyn - Mixed H_{2}/H_{∞} synthesis with regional pole placement constraints
h2syn - Compute H_{2} optimal controller
hinffc - Full-control H-infinity synthesis
hinffi - Full-information H-infinity synthesis
hinfnorm - H_{∞} norm of dynamic system
hinfstruct - H_{∞} tuning of fixed-structure controllers
hinfsyn - Compute H-infinity optimal controller
lncf - Left normalized coprime factorization
loopsens - Sensitivity functions of plant-controller feedback loop
loopsyn - Loop-shaping controller design with tradeoff between performance and robustness
ltrsyn - LQG loop transfer-function recovery (LTR) control synthesis
mixsyn - Mixed-sensitivity H_{∞} synthesis method for robust control loop-shaping design
ncfmargin - Calculate normalized coprime stability margin of plant-controller feedback loop
ncfsyn - Loop shaping design using Glover-McFarlane method
rncf - Right normalized coprime factorization
robgain - Robust performance of uncertain system
robstab - Robust stability of uncertain system
robustperf - (Not recommended) Robust performance margin of uncertain multivariable system
robuststab - (Not recommended) Calculate robust stability margins of uncertain multivariable system
sdhinfnorm - Compute L_{2} norm of continuous-time system in feedback with discrete-time system
sdhinfsyn - Compute H_{∞} controller for sampled-data system
sdlsim - Time response of sampled-data feedback system
slowfast - (Not recommended) Slow and fast modes decomposition
ucover - Fit uncertain model to set of LTI responses
wcdiskmargin - Worst-case disk-based stability margins of uncertain feedback loops
wcdiskmarginplot - Visualize worst-case disk-based stability margins
wcgain - Worst-case gain of uncertain system
wcsigmaplot - Plot worst-case gain of uncertain system
conj - Form model with complex conjugate coefficients
ctranspose - Conjugate dynamic system model
squeeze - Remove singleton dimensions for umat objects
permute - Rearrange array dimensions in model arrays
isfinite - Determine if model has finite coefficients
isreal - Determine if model has real-valued coefficients
hasInternalDelay - Determine if model has internal delays
hasdelay - True for linear model with time delays
isstatic - Determine if model is static or dynamic
isempty - Determine whether dynamic system model is empty
issiso - Determine if dynamic system model is single-input/single-output (SISO)
ndims - Query number of dimensions of dynamic system model or model array
nblocks - Number of control design blocks in generalized LTI model or generalized matrix
nmodels - Number of models in model array
isParametric - Determine if model has tunable parameters
append - Group models by appending their inputs and outputs
blkdiag - Block-diagonal concatenation of models
get - Access model property values
getValue - Current value of generalized model
repmat - Replicate and tile array
reshape - Change shape of model array
size - Query output/input/array dimensions of input–output model and number of frequencies of FRD model
stack - Build model array by stacking models or model arrays along array dimensions
voidModel - Mark missing or irrelevant models in model array
feedback - Feedback connection of multiple models
getBlockValue - Get current value of Control Design Block in Generalized Model
imp2exp - Convert implicit linear relationship to explicit input-output relation
inv - Invert dynamic system models
lft - Generalized feedback interconnection of two models (Redheffer star product)
parallel - Parallel connection of two models
replaceBlock - Replace or update control design blocks in generalized model
rsampleBlock - Randomly sample Control Design blocks in generalized model
sampleBlock - Sample Control Design blocks in generalized model
series - Series connection of two models
setBlockValue - Modify value of Control Design Block in Generalized Model
showBlockValue - Display current values of Control Design Blocks in Generalized Model
showTunable - Display current value of tunable Control Design Blocks in Generalized Model
sminreal - Eliminates structurally disconnected states, delays, and blocks
getNominal - Nominal value of uncertain model
gridureal - Grid ureal parameters uniformly over their range
lftdata - Decompose uncertain objects into fixed certain and normalized uncertain parts
simplify - Simplify representation of uncertain object
uscale - Scale uncertainty of block or system
usubs - Substitute given values for uncertain elements of uncertain objects
modred - (Not recommended) Eliminate states from state-space models
xperm - Reorder states in state-space models
augoffset - Map offset contribution to extra input channel
augstate - Append state vector to output vector
ctrb - Controllability of state-space model
gram - Controllability and observability Gramians
obsv - Observability of state-space model
ss2ss - State coordinate transformation for state-space model
ssequiv - Equivalence transformation for state-space models
xelim - Eliminate states from state-space models
Examples
SISO State-Space Model
Create Discrete-Time State-Space Model
Continuous-Time MIMO State-Space Model
Discrete-Time MIMO State-Space Model
Specify State and Input Names for State-Space Model
State-Space Model with Inherited Properties
MIMO Static Gain State-Space Model
Convert Transfer Function to State-Space Model
Extract State-Space Models from Identified Model
Explicit Realization of Descriptor State-Space Model
Create State-Space Model with Both Fixed and Tunable Parameters
State-Space Model with Input and Output Delay
Stability Analysis of State-Space Systems
Control Design Using State-Space Models
Connect Specific Inputs and Outputs of State-Space Models in a Feedback Loop
Create State-Space Model with Offsets
See also dss, frd, get, set, ssdata, tf, zpk, genss,
uss (Robust Control Toolbox), mechss, sparss, ltvss, lpvss
Introduced in Control System Toolbox before R2006a
Documentation for ss
Other uses of ss
A few Examples
Given the following state-space description of a continuous-time dynamical system
the corresponding MATLAB object is given by
A = [0 -1;-3 2]; B = [3;0]; C=[4 0]; D=2; % the system matrices
sysC = ss(A, B, C, D) %#ok<NASGU> % the LTI system
sysC =
A =
x1 x2
x1 0 -1
x2 -3 2
B =
u1
x1 3
x2 0
C =
x1 x2
y1 4 0
D =
u1
y1 2
Continuous-time state-space model.
Model Properties
Consider a continuous-time dynamical system, described by the model
then
A = [0 +1 0;0 0 +1; 1 -2 +3]; B = [0; 0; 6]; C=[1 0 0]; D=0; % the system matrices
sysC_2 = ss(A, B, C, D) %#ok<NASGU> % the LTI system
sysC_2 =
A =
x1 x2 x3
x1 0 1 0
x2 0 0 1
x3 1 -2 3
B =
u1
x1 0
x2 0
x3 6
C =
x1 x2 x3
y1 1 0 0
D =
u1
y1 0
Continuous-time state-space model.
Model Properties
LTI-System Object from the Transfer Function
Given a transfer function as model for an LTI system, you can create an LTI-model object by using the tf or the zpk command:
help tf
tf - Transfer function model
Use tf to create real-valued or complex-valued transfer function models,
or to convert dynamic system models to transfer function form.
Creation
Create Transfer Function Model
sys = tf(numerator,denominator)
sys = tf(numerator,denominator,ts)
sys = tf(numerator,denominator,ltiSys)
sys = tf(m)
sys = tf(___,PropertyName=Value)
Convert To Transfer Function Model
sys = tf(ltiSys)
sys = tf(ltiSys,Name=Value)
sys = tf(ltiSys,component)
Create Variable for Rational Expression
s = tf('s')
z = tf('z',ts)
Input Arguments
numerator - Numerator coefficients of the transfer function
row vector | Ny-by-Nu cell array of row vectors
denominator - Denominator coefficients of the transfer function
row vector | Ny-by-Nu cell array of row vectors
ts - Sample time
scalar
ltiSys - Dynamic system
dynamic system model | model array
m - Static gain
scalar | matrix
component - Component of identified model
'measured' (default) | 'noise' | 'augmented'
Name-Value Arguments
UseParallel - Use parallel computing
0 or false (default) | 1 or true
RollOff - Roll-off slope
0 (default) | nonpositive scalar | matrix
Focus - Frequency range of interest
[0 Inf] (default) | vector
MaxNumber - Maximum number of poles and zeros to compute
1000 (default) | positive integer
Shift - Spectral shift
0 (default) | finite scalar
Tolerance - Accuracy of computed poles and zeros
1e-12 (default) | positive finite scalar
Display - Show or hide progress report
"on" (default) | "off"
Output Arguments
sys - Output system model
tf model object | genss model object | uss model object
Properties
Numerator - Numerator coefficients
row vector | Ny-by-Nu cell array of row vectors
Denominator - Denominator coefficients
row vector | Ny-by-Nu cell array of row vectors
Variable - Transfer function display variable
's' (default) | 'z' | 'p' | 'q' | 'z^-1' | 'q^-1'
IODelay - Transport delay
0 (default) | scalar | Ny-by-Nu array
InputDelay - Input delay
0 (default) | scalar | Nu-by-1 vector
OutputDelay - Output delay
0 (default) | scalar | Ny-by-1 vector
Ts - Sample time
0 (default) | positive scalar | -1
TimeUnit - Time variable units
'seconds' (default) | 'nanoseconds' | 'microseconds' |
'milliseconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'months' |
'years' | ...
InputName - Input channel names
'' (default) | character vector | cell array of character vectors
InputUnit - Input channel units
'' (default) | character vector | cell array of character vectors
InputGroup - Input channel groups
structure
OutputName - Output channel names
'' (default) | character vector | cell array of character vectors
OutputUnit - Output channel units
'' (default) | character vector | cell array of character vectors
OutputGroup - Output channel groups
structure
Name - System name
'' (default) | character vector
Notes - User-specified text
{} (default) | character vector | cell array of character vectors
UserData - User-specified data
[] (default) | any MATLAB data type
SamplingGrid - Sampling grid for model arrays
structure array
Object Functions
exp - Create pure continuous-time delays
totaldelay - Total combined I/O delays for LTI model
balancmr - (Not recommended) Balanced model truncation via square root method
bilin - Multivariable bilinear transform of frequency (s or z)
dcgainmr - (Not recommended) Reduced order model
hankelmr - (Not recommended) Hankel minimum degree approximation (MDA) without balancing
hankelsv - (Not recommended) Compute Hankel singular values for stable/unstable or continuous/discrete system
ltiarray2uss - Compute uncertain system bounding given LTI ss array
schurmr - (Not recommended) Balanced model truncation via Schur method
sectf - State-space sector bilinear transformation
absorbDelay - Replace time delays by poles at z = 0 or phase shift
bode - Bode frequency response of dynamic system
bodemag - Magnitude-only Bode plot of frequency response
c2d - Convert model from continuous to discrete time
canon - (Not recommended) Canonical state-space realization
chgTimeUnit - Change time units of dynamic system
connect - Block diagram interconnections of dynamic systems
d2c - Convert model from discrete to continuous time
d2d - Resample discrete-time model
dcgain - Low-frequency (DC) gain of LTI system
delay2z - Replace delays of discrete-time TF, SS, or ZPK models by poles at z=0, or replace delays of FRD models by phase shift
evalfr - Evaluate system response at specific frequency
findop - Compute operating condition from specifications
impulse - Impulse response plot of dynamic system; impulse response data
interp - Interpolate FRD model
iopzmap - Plot pole-zero map for input-output pairs of dynamic system using default options
isct - Determine if dynamic system model is in continuous time
isdt - Determine if dynamic system model is in discrete time
isproper - Determine if dynamic system model is proper
isstable - Determine if dynamic system model is stable
lsim - Compute time response simulation data of dynamic system to arbitrary inputs
nyquist - Nyquist response of dynamic system
order - Query model order
pole - Poles of dynamic system
pzmap - Pole-zero map of dynamic system
repsys - Replicate and tile models
set - Set or modify model properties
ssdata - Access state-space model data
step - Step response of dynamic system
tfdata - Access transfer function data
zero - Zeros and gain of SISO dynamic system
zpkdata - Access zero-pole-gain data
allmargin - Gain margin, phase margin, delay margin, and crossover frequencies
bandwidth - Frequency response bandwidth
covar - Output and state covariance of system driven by white noise
damp - Natural frequency and damping ratio
getGainCrossover - Crossover frequencies for specified gain
getPassiveIndex - Compute passivity index of linear system
getPeakGain - Peak gain of dynamic system frequency response
getSectorCrossover - Crossover frequencies for sector bound
getSectorIndex - Compute conic-sector index of linear system
initial - System response to initial states of state-space model
isPassive - Check passivity of linear systems
margin - Gain margin, phase margin, and crossover frequencies
nichols - Nichols response of dynamic system
norm - Norm of linear model
passiveplot - Compute or plot passivity index as function of frequency
sectorplot - Compute or plot sector index as function of frequency
sigma - Singular values of frequency response of dynamic system
stepinfo - Rise time, settling time, and other step-response characteristics
tzero - Invariant zeros of linear system
looptune - Tune fixed-structure feedback loops
looptuneSetup - Convert tuning setup for looptune to tuning setup for systune
loopview - Graphically analyze MIMO feedback loops
pidtune - PID tuning algorithm for linear plant model
rlocus - Root locus of dynamic system
systune - Tune fixed-structure control systems modeled in MATLAB
balreal - Balanced state-space realization
dssdata - Extract descriptor state-space data
freqsep - Slow-fast decomposition
mechssdata - Access second-order sparse state-space model data
minreal - Minimal realization or pole-zero cancellation
modalsep - Compute modal decomposition
piddata - Access coefficients of parallel-form PID controller
piddata2 - Access coefficients of parallel-form 2-DOF PID controller
pidstddata - Access coefficients of standard-form PID controller
pidstddata2 - Access coefficients of standard-form 2-DOF PID controller
sparssdata - Access first-order sparse state-space model data
spectralfact - Spectral factorization of linear systems
stabsep - Stable-unstable decomposition
upsample - Upsample discrete-time models
balred - (Not recommended) Model order reduction
hsvd - (Not recommended) Hankel singular values of dynamic system
hsvplot - (Not recommended) Plot Hankel singular values
dksynperf - (Not recommended) Robust H_{∞} performance optimized by dksyn
loopmargin - (Not recommended) Stability margin analysis of LTI and Simulink feedback loops
mktito - Partition LTI system into two-input/two-output system
modreal - (Not recommended) Modal form realization and projection
ncfmr - (Not recommended) Model reduction from normalized coprime factorization
wcmargin - (Not recommended) Worst-case disk stability margins of uncertain feedback loops
wcsens - (Not recommended) Calculate worst-case sensitivity and complementary sensitivity functions of plant-controller feedback loop
augw - Plant augmentation for weighted mixed-sensitivity H_{∞} and H_{2} loop-shaping design
bstmr - (Not recommended) Balanced stochastic model truncation (BST) via Schur method
diskmargin - Disk-based stability margins of feedback loops
diskmarginplot - Visualize disk-based stability margins
gapmetric - Gap metric and Vinnicombe (nu-gap) metric for distance between two systems
h2hinfsyn - Mixed H_{2}/H_{∞} synthesis with regional pole placement constraints
h2syn - Compute H_{2} optimal controller
hinffc - Full-control H-infinity synthesis
hinffi - Full-information H-infinity synthesis
hinfnorm - H_{∞} norm of dynamic system
hinfstruct - H_{∞} tuning of fixed-structure controllers
hinfsyn - Compute H-infinity optimal controller
lncf - Left normalized coprime factorization
loopsens - Sensitivity functions of plant-controller feedback loop
loopsyn - Loop-shaping controller design with tradeoff between performance and robustness
ltrsyn - LQG loop transfer-function recovery (LTR) control synthesis
mixsyn - Mixed-sensitivity H_{∞} synthesis method for robust control loop-shaping design
ncfmargin - Calculate normalized coprime stability margin of plant-controller feedback loop
ncfsyn - Loop shaping design using Glover-McFarlane method
rncf - Right normalized coprime factorization
robgain - Robust performance of uncertain system
robstab - Robust stability of uncertain system
robustperf - (Not recommended) Robust performance margin of uncertain multivariable system
robuststab - (Not recommended) Calculate robust stability margins of uncertain multivariable system
sdhinfnorm - Compute L_{2} norm of continuous-time system in feedback with discrete-time system
sdhinfsyn - Compute H_{∞} controller for sampled-data system
sdlsim - Time response of sampled-data feedback system
slowfast - (Not recommended) Slow and fast modes decomposition
ucover - Fit uncertain model to set of LTI responses
wcdiskmargin - Worst-case disk-based stability margins of uncertain feedback loops
wcdiskmarginplot - Visualize worst-case disk-based stability margins
wcgain - Worst-case gain of uncertain system
wcsigmaplot - Plot worst-case gain of uncertain system
conj - Form model with complex conjugate coefficients
ctranspose - Conjugate dynamic system model
squeeze - Remove singleton dimensions for umat objects
permute - Rearrange array dimensions in model arrays
isfinite - Determine if model has finite coefficients
isreal - Determine if model has real-valued coefficients
hasInternalDelay - Determine if model has internal delays
hasdelay - True for linear model with time delays
isstatic - Determine if model is static or dynamic
isempty - Determine whether dynamic system model is empty
issiso - Determine if dynamic system model is single-input/single-output (SISO)
ndims - Query number of dimensions of dynamic system model or model array
nblocks - Number of control design blocks in generalized LTI model or generalized matrix
nmodels - Number of models in model array
isParametric - Determine if model has tunable parameters
append - Group models by appending their inputs and outputs
blkdiag - Block-diagonal concatenation of models
get - Access model property values
getValue - Current value of generalized model
repmat - Replicate and tile array
reshape - Change shape of model array
size - Query output/input/array dimensions of input–output model and number of frequencies of FRD model
stack - Build model array by stacking models or model arrays along array dimensions
voidModel - Mark missing or irrelevant models in model array
feedback - Feedback connection of multiple models
getBlockValue - Get current value of Control Design Block in Generalized Model
imp2exp - Convert implicit linear relationship to explicit input-output relation
inv - Invert dynamic system models
lft - Generalized feedback interconnection of two models (Redheffer star product)
parallel - Parallel connection of two models
replaceBlock - Replace or update control design blocks in generalized model
rsampleBlock - Randomly sample Control Design blocks in generalized model
sampleBlock - Sample Control Design blocks in generalized model
series - Series connection of two models
setBlockValue - Modify value of Control Design Block in Generalized Model
showBlockValue - Display current values of Control Design Blocks in Generalized Model
showTunable - Display current value of tunable Control Design Blocks in Generalized Model
sminreal - Eliminates structurally disconnected states, delays, and blocks
getNominal - Nominal value of uncertain model
gridureal - Grid ureal parameters uniformly over their range
lftdata - Decompose uncertain objects into fixed certain and normalized uncertain parts
simplify - Simplify representation of uncertain object
uscale - Scale uncertainty of block or system
usubs - Substitute given values for uncertain elements of uncertain objects
Examples
SISO Transfer Function Model
Discrete-Time SISO Transfer Function Model
Second-Order Transfer Function from Damping Ratio and Natural Frequency
Discrete-Time MIMO Transfer Function Model
Concatenate SISO Transfer Functions into MIMO Transfer Function Model
Transfer Function Model Using Rational Expression
Discrete-Time Transfer Function Model Using Rational Expression
Transfer Function Model with Inherited Properties
Array of Transfer Function Models
Convert State-Space Model to Transfer Function
Extract Transfer Functions from Identified Model
Specify Input and Output Names for MIMO Transfer Function Model
Specify Polynomial Ordering in Discrete-Time Transfer Function
Tunable Low-Pass Filter
Static Gain MIMO Transfer Function Model
Compute Truncated Transfer Function Approximation of Sparse Model
See also filt, frd, get, set, ss, tfdata, zpk, genss, realp, genmat,
tunableTF
Introduced in Control System Toolbox before R2006a
Documentation for tf
Other uses of tf
help zpk
zpk - Zero-pole-gain model
Use zpk to create zero-pole-gain models, or to convert dynamic system
models to zero-pole-gain form.
Creation
Create ZPK Model
sys = zpk(zeros,poles,gain)
sys = zpk(zeros,poles,gain,ts)
sys = zpk(zeros,poles,gain,ltiSys)
sys = zpk(m)
sys = zpk(___,PropertyName=Value)
Convert To ZPK Model
sys = zpk(ltiSys)
sys = zpk(ltiSys,Name=Value)
sys = zpk(ltiSys,component)
Create Variable for Rational Expression
s = zpk('s')
z = zpk('z',ts)
Input Arguments
zeros - Zeros of the zero-pole-gain model
row vector | Ny-by-Nu cell array of row vectors
poles - Poles of the zero-pole-gain model
row vector | Ny-by-Nu cell array of row vectors
gain - Gain of the zero-pole-gain model
scalar | Ny-by-Nu matrix
ts - Sample time
scalar
ltiSys - Dynamic system
dynamic system model | model array
m - Static gain
scalar | matrix
component - Component of identified model
'measured' (default) | 'noise' | 'augmented'
Name-Value Arguments
UseParallel - Use parallel computing
0 or false (default) | 1 or true
RollOff - Roll-off slope
0 (default) | nonpositive scalar | matrix
Focus - Frequency range of interest
[0 Inf] (default) | vector
MaxNumber - Maximum number of poles and zeros to compute
1000 (default) | positive integer
Shift - Spectral shift
0 (default) | finite scalar
Tolerance - Accuracy of computed poles and zeros
1e-12 (default) | positive finite scalar
Display - Show or hide progress report
"on" (default) | "off"
Output Arguments
sys - Output system model
zpk model object | genss model object | uss model object
Properties
Z - System zeros
cell array | Ny-by-Nu cell array of row vectors
P - System poles
cell array | Ny-by-Nu cell array of row vectors
K - System gains
scalar | Ny-by-Nu matrix
DisplayFormat - Specifies how the numerator and denominator polynomials are factorized for display
'roots' (default) | 'frequency' | 'time constant'
Variable - Zero-pole-gain model display variable
's' (default) | 'z' | 'p' | 'q' | 'z^-1' | 'q^-1'
IODelay - Transport delay
0 (default) | scalar | Ny-by-Nu array
InputDelay - Input delay
0 (default) | scalar | Nu-by-1 vector
OutputDelay - Output delay
0 (default) | scalar | Ny-by-1 vector
Ts - Sample time
0 (default) | positive scalar | -1
TimeUnit - Time variable units
'seconds' (default) | 'nanoseconds' | 'microseconds' |
'milliseconds' | 'minutes' | 'hours' | 'days' | 'weeks' | 'months' |
'years' | ...
InputName - Input channel names
'' (default) | character vector | cell array of character vectors
InputUnit - Input channel units
'' (default) | character vector | cell array of character vectors
InputGroup - Input channel groups
structure
OutputName - Output channel names
'' (default) | character vector | cell array of character vectors
OutputUnit - Output channel units
'' (default) | character vector | cell array of character vectors
OutputGroup - Output channel groups
structure
Name - System name
'' (default) | character vector
Notes - User-specified text
{} (default) | character vector | cell array of character vectors
UserData - User-specified data
[] (default) | any MATLAB data type
SamplingGrid - Sampling grid for model arrays
structure array
Object Functions
exp - Create pure continuous-time delays
totaldelay - Total combined I/O delays for LTI model
balancmr - (Not recommended) Balanced model truncation via square root method
bilin - Multivariable bilinear transform of frequency (s or z)
dcgainmr - (Not recommended) Reduced order model
hankelmr - (Not recommended) Hankel minimum degree approximation (MDA) without balancing
hankelsv - (Not recommended) Compute Hankel singular values for stable/unstable or continuous/discrete system
ltiarray2uss - Compute uncertain system bounding given LTI ss array
schurmr - (Not recommended) Balanced model truncation via Schur method
sectf - State-space sector bilinear transformation
absorbDelay - Replace time delays by poles at z = 0 or phase shift
bode - Bode frequency response of dynamic system
bodemag - Magnitude-only Bode plot of frequency response
c2d - Convert model from continuous to discrete time
canon - (Not recommended) Canonical state-space realization
chgTimeUnit - Change time units of dynamic system
connect - Block diagram interconnections of dynamic systems
d2c - Convert model from discrete to continuous time
d2d - Resample discrete-time model
dcgain - Low-frequency (DC) gain of LTI system
delay2z - Replace delays of discrete-time TF, SS, or ZPK models by poles at z=0, or replace delays of FRD models by phase shift
evalfr - Evaluate system response at specific frequency
findop - Compute operating condition from specifications
impulse - Impulse response plot of dynamic system; impulse response data
interp - Interpolate FRD model
iopzmap - Plot pole-zero map for input-output pairs of dynamic system using default options
isct - Determine if dynamic system model is in continuous time
isdt - Determine if dynamic system model is in discrete time
isproper - Determine if dynamic system model is proper
isstable - Determine if dynamic system model is stable
lsim - Compute time response simulation data of dynamic system to arbitrary inputs
nyquist - Nyquist response of dynamic system
order - Query model order
pole - Poles of dynamic system
pzmap - Pole-zero map of dynamic system
repsys - Replicate and tile models
set - Set or modify model properties
ssdata - Access state-space model data
step - Step response of dynamic system
tfdata - Access transfer function data
zero - Zeros and gain of SISO dynamic system
zpkdata - Access zero-pole-gain data
allmargin - Gain margin, phase margin, delay margin, and crossover frequencies
bandwidth - Frequency response bandwidth
covar - Output and state covariance of system driven by white noise
damp - Natural frequency and damping ratio
getGainCrossover - Crossover frequencies for specified gain
getPassiveIndex - Compute passivity index of linear system
getPeakGain - Peak gain of dynamic system frequency response
getSectorCrossover - Crossover frequencies for sector bound
getSectorIndex - Compute conic-sector index of linear system
initial - System response to initial states of state-space model
isPassive - Check passivity of linear systems
margin - Gain margin, phase margin, and crossover frequencies
nichols - Nichols response of dynamic system
norm - Norm of linear model
passiveplot - Compute or plot passivity index as function of frequency
sectorplot - Compute or plot sector index as function of frequency
sigma - Singular values of frequency response of dynamic system
stepinfo - Rise time, settling time, and other step-response characteristics
tzero - Invariant zeros of linear system
looptune - Tune fixed-structure feedback loops
looptuneSetup - Convert tuning setup for looptune to tuning setup for systune
loopview - Graphically analyze MIMO feedback loops
pidtune - PID tuning algorithm for linear plant model
rlocus - Root locus of dynamic system
systune - Tune fixed-structure control systems modeled in MATLAB
balreal - Balanced state-space realization
dssdata - Extract descriptor state-space data
freqsep - Slow-fast decomposition
mechssdata - Access second-order sparse state-space model data
minreal - Minimal realization or pole-zero cancellation
modalsep - Compute modal decomposition
piddata - Access coefficients of parallel-form PID controller
piddata2 - Access coefficients of parallel-form 2-DOF PID controller
pidstddata - Access coefficients of standard-form PID controller
pidstddata2 - Access coefficients of standard-form 2-DOF PID controller
sparssdata - Access first-order sparse state-space model data
spectralfact - Spectral factorization of linear systems
stabsep - Stable-unstable decomposition
upsample - Upsample discrete-time models
balred - (Not recommended) Model order reduction
hsvd - (Not recommended) Hankel singular values of dynamic system
hsvplot - (Not recommended) Plot Hankel singular values
dksynperf - (Not recommended) Robust H_{∞} performance optimized by dksyn
loopmargin - (Not recommended) Stability margin analysis of LTI and Simulink feedback loops
mktito - Partition LTI system into two-input/two-output system
modreal - (Not recommended) Modal form realization and projection
ncfmr - (Not recommended) Model reduction from normalized coprime factorization
wcmargin - (Not recommended) Worst-case disk stability margins of uncertain feedback loops
wcsens - (Not recommended) Calculate worst-case sensitivity and complementary sensitivity functions of plant-controller feedback loop
augw - Plant augmentation for weighted mixed-sensitivity H_{∞} and H_{2} loop-shaping design
bstmr - (Not recommended) Balanced stochastic model truncation (BST) via Schur method
diskmargin - Disk-based stability margins of feedback loops
diskmarginplot - Visualize disk-based stability margins
gapmetric - Gap metric and Vinnicombe (nu-gap) metric for distance between two systems
h2hinfsyn - Mixed H_{2}/H_{∞} synthesis with regional pole placement constraints
h2syn - Compute H_{2} optimal controller
hinffc - Full-control H-infinity synthesis
hinffi - Full-information H-infinity synthesis
hinfnorm - H_{∞} norm of dynamic system
hinfstruct - H_{∞} tuning of fixed-structure controllers
hinfsyn - Compute H-infinity optimal controller
lncf - Left normalized coprime factorization
loopsens - Sensitivity functions of plant-controller feedback loop
loopsyn - Loop-shaping controller design with tradeoff between performance and robustness
ltrsyn - LQG loop transfer-function recovery (LTR) control synthesis
mixsyn - Mixed-sensitivity H_{∞} synthesis method for robust control loop-shaping design
ncfmargin - Calculate normalized coprime stability margin of plant-controller feedback loop
ncfsyn - Loop shaping design using Glover-McFarlane method
rncf - Right normalized coprime factorization
robgain - Robust performance of uncertain system
robstab - Robust stability of uncertain system
robustperf - (Not recommended) Robust performance margin of uncertain multivariable system
robuststab - (Not recommended) Calculate robust stability margins of uncertain multivariable system
sdhinfnorm - Compute L_{2} norm of continuous-time system in feedback with discrete-time system
sdhinfsyn - Compute H_{∞} controller for sampled-data system
sdlsim - Time response of sampled-data feedback system
slowfast - (Not recommended) Slow and fast modes decomposition
ucover - Fit uncertain model to set of LTI responses
wcdiskmargin - Worst-case disk-based stability margins of uncertain feedback loops
wcdiskmarginplot - Visualize worst-case disk-based stability margins
wcgain - Worst-case gain of uncertain system
wcsigmaplot - Plot worst-case gain of uncertain system
conj - Form model with complex conjugate coefficients
ctranspose - Conjugate dynamic system model
squeeze - Remove singleton dimensions for umat objects
permute - Rearrange array dimensions in model arrays
isfinite - Determine if model has finite coefficients
isreal - Determine if model has real-valued coefficients
hasInternalDelay - Determine if model has internal delays
hasdelay - True for linear model with time delays
isstatic - Determine if model is static or dynamic
isempty - Determine whether dynamic system model is empty
issiso - Determine if dynamic system model is single-input/single-output (SISO)
ndims - Query number of dimensions of dynamic system model or model array
nblocks - Number of control design blocks in generalized LTI model or generalized matrix
nmodels - Number of models in model array
isParametric - Determine if model has tunable parameters
append - Group models by appending their inputs and outputs
blkdiag - Block-diagonal concatenation of models
get - Access model property values
getValue - Current value of generalized model
repmat - Replicate and tile array
reshape - Change shape of model array
size - Query output/input/array dimensions of input–output model and number of frequencies of FRD model
stack - Build model array by stacking models or model arrays along array dimensions
voidModel - Mark missing or irrelevant models in model array
feedback - Feedback connection of multiple models
getBlockValue - Get current value of Control Design Block in Generalized Model
imp2exp - Convert implicit linear relationship to explicit input-output relation
inv - Invert dynamic system models
lft - Generalized feedback interconnection of two models (Redheffer star product)
parallel - Parallel connection of two models
replaceBlock - Replace or update control design blocks in generalized model
rsampleBlock - Randomly sample Control Design blocks in generalized model
sampleBlock - Sample Control Design blocks in generalized model
series - Series connection of two models
setBlockValue - Modify value of Control Design Block in Generalized Model
showBlockValue - Display current values of Control Design Blocks in Generalized Model
showTunable - Display current value of tunable Control Design Blocks in Generalized Model
sminreal - Eliminates structurally disconnected states, delays, and blocks
getNominal - Nominal value of uncertain model
gridureal - Grid ureal parameters uniformly over their range
lftdata - Decompose uncertain objects into fixed certain and normalized uncertain parts
simplify - Simplify representation of uncertain object
uscale - Scale uncertainty of block or system
usubs - Substitute given values for uncertain elements of uncertain objects
Examples
Continuous-Time SISO Zero-Pole-Gain Model
Discrete-Time SISO Zero-Pole-Gain Model
Concatenate SISO Zero-Pole-Gain Models into a MIMO Zero-Pole-Gain Model
Discrete-Time MIMO Zero-Pole-Gain Model
Specify Input Names for Zero-Pole-Gain Model
Continuous-Time Zero-Pole-Gain Model Using Rational Expression
Discrete-Time Zero-Pole-Gain Model Using Rational Expression
Zero-Pole-Gain Model with Inherited Properties
Static Gain MIMO Zero-Pole-Gain Model
Convert State-Space Model to Zero-Pole-Gain Model
Array of Zero-Pole-Gain Models
Extract Zero-Pole-Gain Models from Identified Model
Zero-Pole-Gain Model with Input and Output Delay
Control Design Using Zero-Pole-Gain Models
Compute Truncated ZPK Approximation of Sparse Model
See also filt, frd, get, set, ss, zpkdata, genss, tf, realp, genmat
Introduced in Control System Toolbox before R2006a
Documentation for zpk
Other uses of zpk
Example
Consider the LTI systems
then
numG1 = [ 1 1 ]; denG1 = [ 1 3 16 ]; % coeffs of the polynomials N(s) and D(s)
G1 = tf(numG1, denG1)
G1 =
s + 1
--------------
s^2 + 3 s + 16
Continuous-time transfer function.
Model Properties
Zset = [-1.0 -0.4]; % the zeros
Pset = [0 -8]; % the poles
Kval = 4; % the gain coeff.
G2 = zpk(Zset, Pset, Kval)
G2 =
4 (s+1) (s+0.4)
---------------
s (s+8)
Continuous-time zero/pole/gain model.
Model Properties
Alternative Way of Using the tf Command
Continuous-time and discrete-time ''elementary'' transfer functions can be defined, and used as ''building blocks'' in writing the expressions of the actual transfer functions.
Consider
Gs = exp(-2*s) * (s+1)/(s^2+3*s+2)
Gs =
s + 1
exp(-2*s) * -------------
s^2 + 3 s + 2
Continuous-time transfer function.
Model Properties
Simulation of LTI Systems
The following MATLAB commands are available, both for continuous-time and discrete-time LTI system:
- step: simulation of the step response;
- initial: simulation of the free state and output movements;
- lsim: simulation of the forced movements.
- dcgain: computation of the static gain (DC gain) of an LTI system
Example: Forced Output Movement of a Continuous-Time System
Consider the system
Let's calculate the forced state and output trajectories corresponding to the input
A = [-1 0;-3 -2]; B = [3;0]; C = [4 0]; D = 2; % the system matrices
sysC = ss(A, B, C, D) % the LTI system
sysC =
A =
x1 x2
x1 -1 0
x2 -3 -2
B =
u1
x1 3
x2 0
C =
x1 x2
y1 4 0
D =
u1
y1 2
Continuous-time state-space model.
Model Properties
Tmax = 10; % let's simulate the system behavior in the time interval [0, Tmax]
t = (0:0.001:Tmax); % a vector containing some time instants
u = 2*sin(2*pi*2*t); % the input values -- Notice: we do not apply the Heaviside function!
[y, ~, x] = lsim(sysC, u, t); % evaluate the forced state & output movement
plot(t, x, 'LineWidth', 1.5);
xlabel('time t [s]'); ylabel('state vars');
legend('x_{1}(t)', 'x_{2}(t)', 'Location', 'best')
plot(t,y, 'LineWidth', 1.5); % plotting the results
xlabel('time t [s]'); ylabel('output');
legend('y(t)', 'Location', 'best')
Example: Free Output & State Movements of a Continuous-Time System
Consider the system
and let's evaluate the free state and output trajectories, starting from the initial state
A = [0 +1 0;0 0 +1; -1 -2 -3]; B = [0; 0; 6]; C=[1 0 0]; D=0; % the system matrices
sysC_2 = ss(A, B, C, D); % the LTI system
[y, ~, x] = initial(sysC_2, x0, t); % evaluate the forced state & output movement
plot(t, x, 'LineWidth', 1.5);
xlabel('time t [s]'); ylabel('state vars');
legend('x_{1}(t)', 'x_{2}(t)', 'x_{3}(t)', 'Location', 'best')
plot(t,y, 'LineWidth', 1.5); % plotting the results
xlabel('time t [s]'); ylabel('output');
legend('y(t)', 'Location', 'best')
Example: Output & State Movements of a Continuous-Time System
Consider the system
and let's evaluate the state and output trajectories, starting from the initial state
when applying the input
A = [0 +1 0;0 0 +1; -1 -2 -3];
C=[1 0 0]; D=0; % the system matrices
sysC = ss(A, B, C, D); % the LTI system
Tmax = 10; % let's simulate the system behavior in the time interval [0, Tmax]
t = (0:0.001:Tmax); % a vector containing some time instants
u = 3+2 .* exp(-0.1*t).* sin(2*pi*2*t); % the input values -- Notice: we do not apply the Heaviside function!
[yfree, ~, xfree] = initial(sysC, x0, t); % evaluate the forced state & output movement
[yforced, ~, xforced] = lsim(sysC, u, t); % evaluate the forced state & output movement
plot(t, x, 'LineWidth', 1.5);
xlabel('time t [s]'); ylabel('state vars');
legend('x_{1}(t)', 'x_{2}(t)', 'x_{3}(t)', 'Location', 'best')
plot(t,y, 'LineWidth', 1.5); % plotting the results
xlabel('time t [s]'); ylabel('output');
legend('y(t)', 'Location', 'best')
Example: Computation of the Static Gain
Consider the LTI system
and let's compute the static gain, by exploiting the MATLAB function dcgain:
A = [0 +1 0;0 0 +1; -1 -2 -3];
C=[1 0 0]; D=0; % the system matrices
sysC = ss(A, B, C, D); % the LTI system
Consider the LTI systems
and let's compute the static gain:
numG1 = [ 1 1 ]; denG1 = [ 1 3 16 ]; % coeffs of the polynomials N(s) and D(s)
G1 = tf(numG1, denG1)
G1 =
s + 1
--------------
s^2 + 3 s + 16
Continuous-time transfer function.
Model Properties
Zset = [-1.0 -0.4]; % the zeros
Pset = [0 -8]; % the poles
Kval = 4; % the gain coeff.
G2 = zpk(Zset, Pset, Kval)
G2 =
4 (s+1) (s+0.4)
---------------
s (s+8)
Continuous-time zero/pole/gain model.
Model Properties
G3 = exp(-2*s) * (s+1)/(s^2+3*s+2)
G3 =
s + 1
exp(-2*s) * -------------
s^2 + 3 s + 2
Continuous-time transfer function.
Model Properties
Summary
Using this live script you have learned:
- How to describe an LTI system in MATLAB;
- How to compute in MATLAB the free and the forced state and output movements for an LTI system.
Back to the Index
Use this link to go back to the main live script of the collection.
Back to the Previous Part: Visualization & Programming
Use this link to go back to the previous live script of this collection.