Convert from One Model Type to Another
This example shows how to convert a numeric LTI model from one type (
pid) to another type (
In general, you can convert a model from one type to another type using the model-creation command for the target type. For example, you can use the
tf command to convert an
ss model to transfer function form, or use the
ss command to convert a
zpk model to state-space form.
Create a PID controller.
pid_sys = pid(1,1.5,3)
pid_sys = 1 Kp + Ki * --- + Kd * s s with Kp = 1, Ki = 1.5, Kd = 3 Continuous-time PID controller in parallel form.
pid_sys to a transfer function model.
C = tf(pid_sys)
C = 3 s^2 + s + 1.5 --------------- s Continuous-time transfer function.
C is a
tf representation of
C has the same dynamics as
pid_sys, but stores the dynamic parameters as transfer-function numerator and denominator coefficients instead of proportional, integral, and derivative gains.
You can similarly convert transfer function models to
pid models, provided the
tf model object represents a parallel-form PID controller with .
In general, you can use the technique of this example to convert any type of model to another type of model. For more specific information about converting to a particular model type, see the reference page for that model type.