Create zeropolegain model; convert to zeropolegain model
sys = zpk(Z,P,K)
sys = zpk(Z,p,k,Ts)
sys = zpk(M)
sys = zpk(Z,p,k,ltisys)
s = zpk('s')
z = zpk('z',Ts)
zsys = zpk(sys)
zsys = zpk(sys,
'measured')
zsys = zpk(sys, 'noise')
zsys = zpk(sys, 'augmented')
Used zpk
to create zeropolegain models
(zpk
model objects), or to convert dynamic systems
to zeropolegain form.
creates a continuoustime zeropolegain model with zeros sys = zpk(Z,P,K)
Z
,
poles P
, and gain(s) K
. The
output sys
is a zpk
model
object storing the model data.
In the SISO case, Z
and P
are
the vectors of real or complexvalued zeros and poles, and K
is
the real or complexvalued scalar gain:
$$h\left(s\right)=k\frac{\left(sz\left(1\right)\right)\left(sz\left(2\right)\right)\dots \left(sz\left(m\right)\right)}{\left(sp\left(1\right)\right)\left(sp\left(2\right)\right)\dots \left(sp\left(n\right)\right)}$$
Set Z
or p
to []
for
systems without zeros or poles. These two vectors need not have equal
length and the model need not be proper (that is, have an excess of
poles).
To create a MIMO zeropolegain model, specify the zeros, poles, and gain of each SISO entry of this model. In this case:
Z
and P
are
cell arrays of vectors with as many rows as outputs and as many columns
as inputs, and K
is a matrix with as many rows
as outputs and as many columns as inputs.
The vectors Z{i,j}
and P{i,j}
specify
the zeros and poles of the transfer function from input j
to
output i
.
K(i,j)
specifies the (scalar) gain
of the transfer function from input j
to output i
.
sys = zpk(Z,p,k,Ts)
creates
a discretetime zeropolegain model with sample time Ts
(in
seconds). Set Ts = 1
or Ts = []
to
leave the sample time unspecified. The input arguments Z
, P
, K
are
as in the continuoustime case.
sys = zpk(M)
specifies a static gain M
.
sys = zpk(Z,p,k,ltisys)
creates a zeropolegain model with properties inherited from the
LTI model ltisys
(including the sample time).
To create an array of zpk
model objects,
use a for
loop, or use multidimensional cell arrays
for Z
and P
, and a multidimensional
array for K
.
Any of the previous syntaxes can be followed by property name/property value pairs.
'PropertyName',PropertyValue
Each pair specifies a particular property of the model, for
example, the input names or the input delay time. For more information
about the properties of zpk
model objects, see Properties. Note that
sys = zpk(Z,P,K,'Property1',Value1,...,'PropertyN',ValueN)
is a shortcut for the following sequence of commands.
sys = zpk(Z,P,K) set(sys,'Property1',Value1,...,'PropertyN',ValueN)
You can also use rational expressions to create a ZPK model. To do so, first type either:
s = zpk('s')
to specify a ZPK
model using a rational function in the Laplace variable, s
.
z = zpk('z',Ts)
to specify a
ZPK model with sample time Ts
using a rational
function in the discretetime variable, z
.
Once you specify either of these variables, you can specify
ZPK models directly as rational expressions in the variable s
or z
by
entering your transfer function as a rational expression in either s
or z
.
zsys = zpk(sys)
converts
an arbitrary LTI model sys
to zeropolegain form.
The output zsys
is a ZPK object. By default, zpk
uses zero
to
compute the zeros when converting from statespace to zeropolegain.
Alternatively,
zsys = zpk(sys,'inv')
uses inversion formulas for statespace models to compute the zeros. This algorithm is faster but less accurate for highorder models with low gain at s = 0.
An identified model is represented by an inputoutput equation
of the form y(t) = Gu(t) + He(t)
, where u(t)
is
the set of measured input channels and e(t)
represents
the noise channels. If Λ= LL' represents
the covariance of noise e(t)
, this equation can
also be written as y(t) = Gu(t) + HLv(t)
, where cov(v(t))
= I
.
zsys = zpk(sys)
, or zsys = zpk(sys,
'measured')
converts the measured component of an identified
linear model into the ZPK form. sys
is a model
of type idss
, idproc
, idtf
, idpoly
,
or idgrey
. zsys
represents the
relationship between u
and y
.
zsys = zpk(sys, 'noise')
converts the noise
component of an identified linear model into the ZPK form. It represents
the relationship between the noise input, v(t)
and
output, y_noise = HL v(t)
. The noise input channels
belong to the InputGroup
'Noise'
.
The names of the noise input channels are v@yname
,
where yname
is the name of the corresponding output
channel. zsys
has as many inputs as outputs.
zsys = zpk(sys, 'augmented')
converts both
the measured and noise dynamics into a ZPK model. zsys
has ny+nu
inputs
such that the first nu
inputs represent the channels u(t)
while
the remaining by channels represent the noise channels v(t)
. zsys.InputGroup
contains
2 input groups, 'measured'
and 'noise'
.
zsys.InputGroup.Measured
is set to 1:nu
while zsys.InputGroup.Noise
is
set to nu+1:nu+ny. zsys
represents the equation y(t)
= [G HL] [u; v]
.
Tip:
An identified nonlinear model cannot be converted into a ZPK
system. Use linear approximation functions such as 
As for transfer functions, you can specify which variable to
use in the display of zeropolegain models. Available choices include s (default)
and p for continuoustime models, and z (default), z^{1}, q^{1} (equivalent
to z^{1}), or q (equivalent
to z) for discretetime models. Reassign the 'Variable'
property
to override the defaults. Changing the variable affects only the display
of zeropolegain models.
zpk
objects have the following properties:

System zeros. The  

System poles. The  

System gains. The  

Specifies how the numerator and denominator polynomials are factorized for display purposes. The numerator and denominator polynomials are each displayed
as a product of first and secondorder factors.
For continuoustime models, the following table shows how the polynomial factors are written in each display format.
For discretetime models, the polynomial factors are written as in continuous time, with the following variable substitutions: $$s\to w=\frac{z1}{{T}_{s}};\text{\hspace{1em}}R\to \frac{R1}{{T}_{s}},$$ where T_{s} is the sample time. In discrete time, τ and ω_{0} closely match the time constant and natural frequency of the equivalent continuoustime root, provided z–1 ≪ T_{s} (ω_{0} ≪ π/T_{s} = Nyquist frequency). Default:  

Transfer function display variable, specified as one of the following:
The value of Default:  

Transport delays. For continuoustime systems, specify transport delays in the
time unit stored in the For a MIMO system with Default:  

Input delay for each input channel, specified as a scalar value
or numeric vector. For continuoustime systems, specify input delays
in the time unit stored in the For a system with You can also set Default: 0  

Output delays. For a system with Default: 0 for all output channels  

Sample time. For continuoustime models, Changing this property does not discretize or resample the model.
Use Default:  

Units for the time variable, the sample time
Changing this property has no effect on other properties, and
therefore changes the overall system behavior. Use Default:  

Input channel names, specified as one of the following:
Alternatively, use automatic vector expansion to assign input
names for multiinput models. For example, if sys.InputName = 'controls'; The input names automatically expand to You can use the shorthand notation Input channel names have several uses, including:
Default:  

Input channel units, specified as one of the following:
Use Default:  

Input channel groups. The sys.InputGroup.controls = [1 2]; sys.InputGroup.noise = [3 5]; creates input groups named sys(:,'controls') Default: Struct with no fields  

Output channel names, specified as one of the following:
Alternatively, use automatic vector expansion to assign output
names for multioutput models. For example, if sys.OutputName = 'measurements'; The output names automatically expand to You can use the shorthand notation Output channel names have several uses, including:
Default:  

Output channel units, specified as one of the following:
Use Default:  

Output channel groups. The sys.OutputGroup.temperature = [1]; sys.InputGroup.measurement = [3 5]; creates output groups named sys('measurement',:) Default: Struct with no fields  

System name, specified as a character vector. For example, Default:  

Any text that you want to associate with the system, specified
as a character vector or cell array of character vectors. For example, Default:  

Any type of data you want to associate with system, specified as any MATLAB^{®} data type. Default:  

Sampling grid for model arrays, specified as a data structure. For model arrays that are derived by sampling one or more independent variables, this property tracks the variable values associated with each model in the array. This information appears when you display or plot the model array. Use this information to trace results back to the independent variables. Set the field names of the data structure to the names of the sampling variables. Set the field values to the sampled variable values associated with each model in the array. All sampling variables should be numeric and scalar valued, and all arrays of sampled values should match the dimensions of the model array. For example, suppose you create a 11by1
array of linear models, sysarr.SamplingGrid = struct('time',0:10) Similarly, suppose you create a 6by9
model array, [zeta,w] = ndgrid(<6 values of zeta>,<9 values of w>) M.SamplingGrid = struct('zeta',zeta,'w',w) When you display M M(:,:,1,1) [zeta=0.3, w=5] = 25  s^2 + 3 s + 25 M(:,:,2,1) [zeta=0.35, w=5] = 25  s^2 + 3.5 s + 25 ... For model arrays generated by linearizing a Simulink^{®} model
at multiple parameter values or operating points, the software populates Default: 
Create the continuoustime SISO transfer function:
$$h\left(s\right)=\frac{2s}{\left(s1+j\right)\left(s1j\right)\left(s2\right)}$$
Create h(s) as a zpk
object
using:
h = zpk(0, [1i 1+i 2], 2);
Specify the following oneinput, twooutput zeropolegain model:
$$H\left(z\right)=\left[\begin{array}{c}\frac{1}{z0.3}\\ \frac{2\left(z+0.5\right)}{\left(z0.1+j\right)\left(z0.1j\right)}\end{array}\right].$$
To do this, enter:
Z = {[] ; 0.5}; P = {0.3 ; [0.1+i 0.1i]}; K = [1 ; 2]; H = zpk(Z,P,K,1); % unspecified sample time
Convert the transfer function
h = tf([10 20 0],[1 7 20 28 19 5]);
to zeropolegain form, using:
zpk(h)
This command returns the result:
Zero/pole/gain: 10 s (s2)  (s+1)^3 (s^2 + 4s + 5)
Create a discretetime ZPK model from a rational expression
in the variable z
.
z = zpk('z',0.1); H = (z+.1)*(z+.2)/(z^2+.6*z+.09)
This command returns the following result:
Zero/pole/gain: (z+0.1) (z+0.2)  (z+0.3)^2 Sample time: 0.1
Create a MIMO zpk
model using cell arrays
of zeros and poles.
Create the twoinput, twooutput zeropolegain model
$$H\left(s\right)=\left[\begin{array}{cc}\frac{1}{s}& \frac{3\left(s+5\right)}{{\left(s+1\right)}^{2}}\\ \frac{2\left({s}^{2}2s+2\right)}{\left(s1\right)\left(s2\right)\left(s3\right)}& 0\end{array}\right]$$
by entering:
Z = {[],5;[1i 1+i] []}; P = {0,[1 1];[1 2 3],[]}; K = [1 3;2 0]; H = zpk(Z,P,K);
Use []
as a place holder in Z
or P
when
the corresponding entry of H(s)
has no zeros or poles.
Extract the measured and noise components of an identified polynomial model into two separate ZPK models. The former (measured component) can serve as a plant model while the latter can serve as a disturbance model for control system design.
load icEngine z = iddata(y,u,0.04); nb = 2; nf = 2; nc = 1; nd = 3; nk = 3; sys = bj(z, [nb nc nd nf nk]);
sys
is a model of the form, y(t)
= B/F u(t) + C/D e(t)
, where B/F
represents
the measured component and C/D
the noise component.
sysMeas = zpk(sys, 'measured')
Alternatively, use can simply use zpk(sys)
to
extract the measured component.
sysNoise = zpk(sys, 'noise')
zpk
uses the MATLAB function roots
to
convert transfer functions and the functions zero
and pole
to
convert statespace models.