Conversion Between Model Types
Explicit Conversion Between Model Types
You can explicitly convert a model from one representation to another using the
model-creation command for the target model type. For example, convert to
state-space representation using ss
, and convert to parallel-form
PID using pid
. For information about
converting to a particular model type, see the reference page for that model type.
In general, you can convert from any model type to any other. However, there are a few limitations. For example, you cannot convert:
frd
models to analytic model types such asss
,tf
, orzpk
(unless you perform system identification with System Identification Toolbox™ software).ss
models with internal delays totf
orzpk
.
You can convert between Numeric LTI models and Generalized LTI models.
Converting a Generalized LTI model to a Numeric LTI model evaluates any Control Design Blocks at their current (nominal) value.
Converting a Numeric LTI model to a Generalized LTI model creates a Generalized LTI model with an empty
Blocks
property.
Automatic Conversion Between Model Types
Some algorithms operate only on one type of model object. For example, the
algorithm for zero-order-hold discretization with c2d
can only be performed on
state-space models. Similarly, commands such as tfdata
or
piddata
expect a particular type of model
(tf
or pid
, respectively). For
convenience, such commands automatically convert input models to the appropriate or required model
type. For example:
sys = ss(0,1,1,0) [num,den] = tfdata(sys)
tfdata
automatically converts the state-space model
sys
to transfer function form to return numerator and
denominator data.
Conversions to state-space form are not uniquely defined. For this reason,
automatic conversions to state space do not occur when the result depends on the
choice of state coordinates. For example, the initial
and
kalman
commands require state-space models.
Recommended Working Representation
You can represent numeric system components using any model type. However, Numeric
LTI model types are not equally well-suited for numerical computations. In general,
it is recommended that you work with state-space (ss
) or
frequency response data (frd
) models, for the following
reasons:
The accuracy of computations using high-order transfer functions (
tf
orzpk
models) is sometimes poor, particularly for MIMO or high-order systems. Conversions to a transfer function representation can incur a loss of accuracy.When you convert
tf
orzpk
models to state space usingss
, the software automatically performs balancing and scaling operations. Balancing and scaling improves the numeric accuracy of computations involving the model. For more information about balancing and scaling state-space models, see Scaling State-Space Models.
In addition, converting back and forth between model types can introduce
additional states or orders, or introduce numeric inaccuracies. For example,
conversions to state space are not uniquely defined, and are not guaranteed to
produce a minimal realization for MIMO models. For a given state-space model
sys
,
ss(tf(sys))
can return a model with different state-space matrices, or even a different number of states in the MIMO case.