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
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 as
you perform system identification with System Identification Toolbox™ software).
ss models with internal delays
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
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
a particular type of model (
respectively). For convenience, such commands automatically
convert input models to the appropriate or required model type. For
sys = ss(0,1,1,0) [num,den] = tfdata(sys)
tfdata automatically converts the state-space
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,
require state-space models.
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
frd) models, for the following reasons:
The accuracy of computations using high-order transfer
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
to state space using
ss, 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
can return a model with different state-space matrices, or even a different number of states in the MIMO case.
This example shows how to convert a PID controller model to a transfer function model.
You can use the technique of this example to convert any type of model to another type of model.
Create a PID controller.
pid_sys = pid(1,1.5,3);
pid_sys to a transfer function
C = tf(pid_sys);
C is a
tf model representation
You can similarly convert transfer function models to
tf model object represents a parallel-form
PID controller with
Tf ≥ 0.
This example shows how to get the current value
of a generalized model by converting it to a numeric model. This conversion
is useful, for example, when you have tuned the parameters of the
generalized model using a Robust Control Toolbox™ command such as
Create a Generalized Model
Represent the transfer function
containing a real,
a, which is initialized to 10.
a = realp('a',10); F = tf(a,[1 a]);
F is a
genss model parameterized
Tune the Model
Typically, once of you have a generalized model, you tune the
parameters of the model using a tuning command such as
For this example, instead of tuning the model, manually change the
value of the tunable component of
F.Blocks.a.Value = 5;
Get the current value of the generalized model.
Get the current value of the generalized model by converting it to a numeric model.
F_cur_val = tf(F)
F_cur_val = 5 ----- s + 5 Continuous-time transfer function.
tf(F) converts the generalized model,
to a numeric transfer function,
To view the state-space representation of the current value
To examine the current values of the individual tunable components
in a generalized model, use