454MI: Introduction to MATLAB - Part 5 - LTI Systems
This is the fifth MATLAB live script of the collection ***Using MATLAB in the 454MI "***Data Driven Digital Systems" course, devoted to introduce the MATLAB/Simulink environment and tools for solving practical problems related to the topics of the 454MI course, i.e. performance analysis of dynamic systems, parametric estimation, identification of models from data, and prediction of the evolution of dynamic systems.
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 LTI model from any of these descriptions (use help ltimodels 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)
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 discrete time dynamical system, described by the model
then
A = [0 -1;-3 2]; B = [3;0]; C=[4 0]; D=2; % the system matrices
sysD = ss(A, B, C, D, -1) % the sampling time is unspecified
sysD =
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
Sample time: unspecified
Discrete-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 LTImodel object by using the tf 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
A few Examples
Consider the LTI systems
then
numG1 = [ 1 1 ]; denG1 = [ 1 3 16 ];
G1 = tf(numG1, denG1)
G1 =
s + 1
--------------
s^2 + 3 s + 16
Continuous-time transfer function.
Model Properties
numG2 = conv([1 1],[1 0.4]); denG2 = conv([1 -1],[1 0.8]);
G2 = tf(numG2, denG2, -1)
G2 =
z^2 + 1.4 z + 0.4
-----------------
z^2 - 0.2 z - 0.8
Sample time: unspecified
Discrete-time transfer function.
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
In the discrete time case
Hz = z^(-3)*(z+1)*(z+0.4)/(z-1)/(z+0.8)
Hz =
z^2 + 1.4 z + 0.4
-----------------------
z^5 - 0.2 z^4 - 0.8 z^3
Sample time: unspecified
Discrete-time transfer function.
Model Properties
Issues with the tf( ) Command
First Scenario: from the Open Loop Transfer Function to the Closed Loop Transfer Function
Pay attention! If you use the following (correct) syntax, you will encounter possible numerical problems. In fact, the tf() command is NOT able to handle simplifications correctly.
Consider this simple block diagram
with
Let's determine the closed loop transfer function expression:
Let's determine the closed-loop transfer function using MATLAB:
F1zALT = Hz/(1+Hz)
F1zALT =
z^7 + 1.2 z^6 - 0.68 z^5 - 1.2 z^4 - 0.32 z^3
-------------------------------------------------------------------------------
z^10 - 0.4 z^9 - 1.56 z^8 + 1.32 z^7 + 1.84 z^6 - 0.68 z^5 - 1.2 z^4 - 0.32 z^3
Sample time: unspecified
Discrete-time transfer function.
Model Properties
zpk(F1zALT)
ans =
z^3 (z-1) (z+1) (z+0.8) (z+0.4)
---------------------------------------------------------------------------
z^3 (z-1) (z+0.8) (z+0.5322) (z^2 + 1.266z + 0.4496) (z^2 - 1.999z + 1.672)
Sample time: unspecified
Discrete-time zero/pole/gain model.
Model Properties
- What's happening? It seems like the MATLAB function tf is unable to handle efficiently the simplifications of common terms between the polynomial in the numerator and the polynomial in the denominator of the closed-loop transfer function.
- How to solve this issue?
Limitations
- Transfer function models are ill-suited for numerical computations. Once created, convert them to state-space form before combining them with other models or performing model transformations. You can then convert the resulting models back to transfer function form for inspection purposes.
Second Scenario: Interconnected Systems
Consider the systems described in the following block diagrams:
- Series connection of two continuous-time LTI systems, with a common factor between the numerator and denominator polynomials in the overall transfer function (i.e., there is hidden dynamics in the overall LTI system)
G1s_series = 1/(s-1); G2s_series = (s-1)/(s+2);
G_tot_series = G1s_series*G2s_series
G_tot_series =
s - 1
-----------
s^2 + s - 2
Continuous-time transfer function.
Model Properties
- Parallel connection of two discrete-time LTI systems, with a common factor between the denominator polynomials in both the transfer functions (i.e., there is hidden dynamics in the overall LTI system)
G1z_parallel = z/(z+5); G2z_parallel = 5/(z+5);
G_tot_parallel = (G1z_parallel + G2z_parallel)
G_tot_parallel =
z^2 + 10 z + 25
---------------
z^2 + 10 z + 25
Sample time: unspecified
Discrete-time transfer function.
Model Properties
How Can these Problems Be Addressed?
- In general: convert the transfer function models to state-space form before combining them with other models or performing model transformations.
- The "feedback" issue: use the feedback function instead of the shortcut, or apply the function minreal to the preliminary, not simplified transfer function. Example:
FzMIN = minreal(F1zALT) % <<- use minreal
FzMIN =
z^2 + 1.4 z + 0.4
-------------------------------------------
z^5 - 0.2 z^4 - 0.8 z^3 + z^2 + 1.4 z + 0.4
Sample time: unspecified
Discrete-time transfer function.
Model Properties
FzFeedback = feedback(Hz, 1, -1) % <<- use feedback
FzFeedback =
z^2 + 1.4 z + 0.4
-------------------------------------------
z^5 - 0.2 z^4 - 0.8 z^3 + z^2 + 1.4 z + 0.4
Sample time: unspecified
Discrete-time transfer function.
Model Properties
- The "Interconnected Transfer Function Models" issue: use the command minreal to force the simplification of common terms, or convert the elementary systems into state-space form before combining them. Examples:
% G1s_series = 1/(s-1); G2s_series = (s-1)/(s+2);
% G_tot_series = G1s_series*G2s_series
Gtot_MINREAL = minreal(G1s_series*G2s_series)
Gtot_MINREAL =
1
-----
s + 2
Continuous-time transfer function.
Model Properties
% Series connection of two LTI state-space models
LTIsys1s = ss(G1s_series); LTIsys2s = ss(G2s_series);
LTIsysSERIES = series(LTIsys1s, LTIsys2s)
LTIsysSERIES =
A =
x1 x2
x1 -2 2
x2 0 1
B =
u1
x1 0
x2 1
C =
x1 x2
y1 -1.5 1
D =
u1
y1 0
Continuous-time state-space model.
Model Properties
% ALTERNATIVE WAY -- Series connection of two LTI state-space models
% NB the state equations are not the same as in the previous model!!
LTIsysSERIES_ALT = LTIsys1s * LTIsys2s
LTIsysSERIES_ALT =
A =
x1 x2
x1 1 -1.5
x2 0 -2
B =
u1
x1 1
x2 2
C =
x1 x2
y1 1 0
D =
u1
y1 0
Continuous-time state-space model.
Model Properties
% Back to the transfer function -->> USE MINREAL to simplify the common
% terms (i.e., the HIDDEN DYNAMICS)
minreal(tf(LTIsysSERIES))
ans =
1
-----
s + 2
Continuous-time transfer function.
Model Properties
minreal(tf(LTIsysSERIES_ALT))
ans =
1
-----
s + 2
Continuous-time transfer function.
Model Properties
Additional MATLAB Commands Useful for Handling LTI Systems
A different way to define transfer functions, through poles, zeros, and gain constants:
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
An example:
pSET = [0, 0, 0, 1, -4/5];
HzALT = zpk(zSET, pSET, gainK, -1)
HzALT =
(z+1) (z+0.4)
-----------------
z^3 (z-1) (z+0.8)
Sample time: unspecified
Discrete-time zero/pole/gain model.
Model Properties
What is the order of a given LTI system?
help order
--- help for DynamicSystem/order ---
DynamicSystem/order - Query model order
This MATLAB function returns the model order NS.
Syntax
NS = order(sys)
See also pole, balred
Introduced in Control System Toolbox in R2012a
Documentation for DynamicSystem/order
Other uses of order
A few examples:
How to determine poles and zeros of a SISO LTI system?
help pole
--- help for DynamicSystem/pole ---
DynamicSystem/pole - Poles of dynamic system
This MATLAB function returns the poles of the SISO or MIMO dynamic
system model sys.
Syntax
P = pole(sys)
P = pole(sys,J1,...,JN)
P = pole(___,Name=Value)
Input Arguments
sys - Dynamic system
dynamic system model | model array
J1,...,JN - Indices of models in array whose poles you want to extract
positive integer
Name-Value Arguments
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
1e-12 (default) | positive finite scalar
Display - Show or hide progress report
"on" (default) | "off"
Output Arguments
P - Poles of the dynamic system
column vector | array
Examples
Poles of Discrete-Time Transfer Function
Poles of Transfer Function
Poles of Models in an Array
Compute Poles of Sparse Models
See also damp, esort, dsort, pzmap, zero, step, impulse, pzplot
Introduced in Control System Toolbox before R2006a
Documentation for DynamicSystem/pole
help zero
--- help for DynamicSystem/zero ---
DynamicSystem/zero - Zeros and gain of SISO dynamic system
This MATLAB function returns the zeros of the single-input,
single-output (SISO) dynamic system model, sys.
Syntax
Z = zero(sys)
[Z,gain] = zero(sys)
[Z,gain] = zero(sys,J1,...,JN)
Input Arguments
sys - Dynamic system
dynamic system model | model array
J - Indices of models in array whose zeros you want to extract
positive integer
Output Arguments
Z - Zeros of the dynamic system
column vector | array
gain - Zero-pole-gain of the dynamic system
scalar
Examples
Zeros of Transfer Function
Zeros and Gain of Transfer Function
Zeros and Gain of Models in an Array
See also pole, pzmap, tzero, step, impulse, pzplot
Introduced in Control System Toolbox before R2006a
Documentation for DynamicSystem/zero
Examples:
pole(FzFeedback)
0.9994 + 0.8202i
0.9994 - 0.8202i
-0.6332 + 0.2205i
-0.6332 - 0.2205i
-0.5322 + 0.0000i
How to compute the DC gain of a LTI system?
help dcgain
dcgain - Low-frequency (DC) gain of LTI system
This MATLAB function computes the DC gain k of the LTI model sys.
Syntax
k = dcgain(sys)
Examples
Compute DC Gain of Identified Model
See also evalfr, norm
Introduced in Control System Toolbox before R2006a
Documentation for dcgain
Other uses of dcgain
Examples:
% Gs = exp(-2*s) * (s+1)/(s^2+3*s+2)
% FzFeedback = feedback(Hz, 1, -1)
How to Connect Two LTI Systems?
Feedback connection of two models:
help feedback
feedback - Feedback connection of multiple models
This MATLAB function returns a model object sys for the negative
feedback interconnection of model objects sys1,sys2.
Syntax
sys = feedback(sys1,sys2)
sys = feedback(sys1,sys2,feedin,feedout)
sys = feedback(sys1,sys2,'name')
sys = feedback(___,sign)
Input Arguments
sys1,sys2 - Systems to connect in a feedback loop
dynamic system models
feedin - Subset of inputs to be used
vector
feedout - Subset of outputs to be used
vector
sign - Type of feedback
-1 (default) | +1
Output Arguments
sys - Closed-loop system
dynamic system model
Examples
Plant and Controller with Unit Feedback
Plant with Controller in Negative Feedback Path
Positive Feedback Loop with Plant and Controller
Negative Feedback Loop with MIMO Systems
Feedback Loop Based on I/O Names
Specify Input and Output Connections in a Feedback Loop
See also append, connect, series, lft, sumblk, parallel
Introduced in Control System Toolbox before R2006a
Documentation for feedback
Other uses of feedback
Series connection of two LTI systems:
help series
series - Series connection of two models
This MATLAB function forms the series interconnection of two dynamic
system models by connecting the outputs of sys1 to the inputs of sys2,
as shown in the diagram.
Syntax
sys = series(sys1,sys2)
sys = series(sys1,sys2,out1,in2)
sys = series(sys1,sys2,"name")
Input Arguments
sys1 - Systems to connect
dynamic system model | control design block | model array
sys2 - Systems to connect
dynamic system model | control design block | model array
out1 - Outputs to connect
vector
in2 - Inputs to connect
vector
Output Arguments
sys - Interconnected system
dynamic system model
Examples
Connect SISO Systems in Series
Connect MIMO Systems in Series
Connect Subset of Outputs and Inputs Using Signal Names
Connect Subset of Outputs and Inputs Using Indices
See also feedback, connect, parallel, append
Introduced in Control System Toolbox before R2006a
Documentation for series
Other uses of series
Parallel connection of two models:
help parallel
Parallel Computing Toolbox
Version 25.1 (R2025a) 21-Nov-2024
Toolbox Functions For Clusters
batch - Run MATLAB function or script on worker
fetchCloudClusters - Returns an array of your cloud clusters
gcp - Returns the current parallel pool
parcluster - Build a Cluster from a cluster profile
parfeval - Execute function on worker in parallel pool
parfor - Execute for loop in parallel on workers in parallel pool
parpool - Create a parallel pool of workers on a cluster and return a pool object
spmd - Single Program Multiple Data
Other Toolbox Contents
parallel.cluster - Use a cluster
parallel.gpu - Use your computer's graphics processing unit (GPU)
parallel/lang - Parallel computing programming language constructs
parallel/mpi - Using the Message Passing Interface
array/distributed - Parallel Algorithms
See also demo toolbox parallel.
parallel is both a directory and a function.
parallel - Create parallel sum filter structure
This MATLAB function returns an object PF of type dsp.ParallelFilter.
Syntax
PF = parallel(branch1,branch2,...,branchn)
Input Arguments
branch - Filter branch
filter System object | scalar
Output Arguments
PF - Parallel filter
dsp.ParallelFilter System object
Examples
Construct Parallel Filter
See also dsp.ParallelFilter
Introduced in DSP System Toolbox before R2006a
Documentation for parallel
Parallel Computing Toolbox Documentation
Other uses of parallel
Folders named parallel
Block diagram interconnections of LTI systems:
help connect
connect - Block diagram interconnections of dynamic systems
This MATLAB function connects the models and block diagram elements
sys1,...sysN based on signal names.
Syntax
sysc = connect(sys1,...sysN,inputs,outputs)
sysc = connect(sys1,...sysN,inputs,outputs,APs)
sysc = connect(blksys,connections,inputs,outputs)
sysc = connect(___,opts)
Input Arguments
sys - Dynamic system model or other element to interconnect
LTI model object | control design block | AnalysisPoint block |
identified model | sparse model object | time-varying model object |
parameter-varying model object | time-varying model object
inputs - Inputs of combined model
character vector | cell array of character vectors | string |
string vector | positive integer | vector of positive integers
outputs - Outputs of combined model
character vector | cell array of character vectors | string |
string vector | positive integer | vector of positive integers
APs - Locations of interest in the combined model
character vector | cell array of character vectors | string |
string vector
blksys - Unconnected aggregate model
dynamic system model
connections - Connections and summing junctions
matrix
opts - Additional options for interconnection
connectOptions options set
Output Arguments
sysc - Interconnected system
state-space model | frequency-response data model
Examples
SISO Control System
MIMO Control System
Feedback Loop with Analysis Point
Index-Based Interconnection
Combine Two Interconnected Models with Analysis Points
See also sumblk, AnalysisPoint, append, feedback, parallel, series, lft,
connectOptions
Introduced in Control System Toolbox before R2006a
Documentation for connect
Other uses of connect
Group LTI models by appending their inputs and outputs:
help append
append - Combine strings
This MATLAB function combines the text from str1,...,strN.
Syntax
str = append(str1,...,strN)
Input Arguments
str1,...,strN - Input text
string arrays | character vectors | cell arrays of character vectors
Examples
Combine Strings
Combine Character Vectors
Combine Arrays of Text
Implicit Expansion
See also cat, vertcat, horzcat, cellstr, strjoin, join, strcat, plus
Introduced in MATLAB in R2019a
Documentation for append
Other uses of append
Realization: from Transfer Functions to a State-Space Representation for SISO Systems
Recall that to realize a SISO LTI system in state-space equations form means to determine a set of state equations representing the given LTI system, corresponding to the assigned transfer function, which actually describes the system (refer to the "Fundamentals of Automatic Control" class material, in particular to Part 4).
Important Remark
The algorithms we analyzed in the "Fundamentals of Automatic Control" class (i.e., the realizations in "Control Form" and in "Observation Form") remain valid for discrete-time LTI systems.
Realization in Control Form: a Recap
Consider the generic not strictly proper transfer function
Then the realization in Control Form is
Refer to Part 4 of the Fundamentals of Automatic Control class material for details.
Realization in Observation Form: a Recap
Consider the generic not strictly proper transfer function
Then the realization in Observation Form is
Refer to Part 4 of the Fundamentals of Automatic Control class material for details.
Realization in Control Form and in Observation Form using MATLAB
Simulation of LTI Systems
The following MATLAB commands are available, both for continuous-time and discrete-time LTI system:
- impulse: simulation of impulse response;
- step: simulation of the step response;
- initial: simulation of the free state and output movements;
- lsim: simulation of the forced movements.
First Example: Forced Output Movement of a Continuous-Time System
c=[1,2];d=0; % the system matrices
sysC = ss(a,b,c,d); % the LTI system object
t=(0:0.01:5); % a vector containing some time instants
u=2*sin(2*pi*2*t); % the corresponding input values
y=lsim(sysC,u,t); % evaluate the forced output movement
plot(t,y); % plotting the results
An Exercise
Write a piece of code for the evaluation of the free state movement of the system sysC, starting from a random initial state
. Hint: have a look to
help initial
initial - System response to initial states of state-space model
For state-space and sparse state-space models, initial computes the
unforced system response y to initial states xinit.
Syntax
[y,tOut] = initial(sys,IC)
[y,tOut] = initial(sys,IC,t)
[y,tOut] = initial(sys,IC,t,p)
[y,tOut,x] = initial(___)
[y,tOut,x,pOut] = initial(sys,IC,t,p)
initial(___)
Input Arguments
sys - Dynamic state-space model
dynamic state-space model | model array
t - Time steps
positive scalar | two-element vector | vector | []
IC - Initial condition
vector | RespConfig object | operating condition created with findop
p - LPV model parameter trajectory
matrix | function handle
Output Arguments
y - Response data
array
tOut - Times at which response is computed
vector
x - State trajectories
array
pOut - Parameter trajectories
array
Examples
Initial Conditions Response Plot
Response of State-Space Model to Initial Condition
Initial Condition Response Plot of MIMO System
Initial Conditions Response Plot at Specified Time
Initial Condition Responses of Multiple Systems
Initial Condition Response Data of State-Space Model
Initial Condition Response Data with Specified Time
Initial Response of Linear-Parameter Varying State-Space Model
Compute Initial-Condition Response of Model with Complex Coefficients
See also initialplot, impulse, lsim, Linear System Analyzer, step
Introduced in Control System Toolbox before R2006a
Documentation for initial
Other uses of initial
rng(481516) % initialize the random numbers generator
% NB this action guarantees to obtain the same sequence of random values at every script run
x0 = randn(order(sysC), 1); % <<-- the random Initial State (Initial Condition - IC)
% insert your the code below this line
Another Example: Step Response of a Sampled-Time LTI System
% sampled time LTI system
Ts = 0.1; % the sampling period
sysD = tf([2 1],[1 0.2 0.5], Ts);
figure;step(sysD); % the step response
Summary
Using this live script you have:
- learned how to describe, manage, and simulate an LTI system in MATLAB;
Back to the Index
Use this link to go back to the main live script of the collection.
Back to the Previous Part: Functions
Use this link to go back to the previous live script of this collection.
Go to the Next Part: Symbolic Math Computations
Use this link to go to the next live script of the collection.