You are on page 1of 6

ELE 421 Control Systems Laboratory

LABORATORY I Title: Transformation of Mathematical Models of Dynamic Systems Objectives: To have each student become familiar with MATLAB by engaging
in exercises with concepts from transforming linear time invariant mathematical models to other time varying mathematical models. MATLAB has useful commands to transform a mathematical model of a linear time invariant system to another model. The following are linear system transformations that are useful for solving control engineering problems: Transfer-function to state-space conversion (tf2ss) State space to transfer function conversion (ss2tf) State space to zero-pole conversion (ss2zp) Zero pole to state-space conversion (zp2ss) Transfer-function to zero-pole conversion (tf2zp) Zero-pole to transfer-function conversion (zp2tf) Continuous time to discrete time conversion (c2d) We begin our discussion with the transformation from the transfer function to state-space. Transfer function to state space. The command [A,B,C,D] = tf2ss(num,den) converts a system from the transferfunction form: Y(s)/U(s) = num/den = C(sI A)-1B + D To the state space form: x = Ax + Bu y = Cx + Du It is important to note that the state-space representation of any system is not unique: There are many (infinitely many) state-space representation of the same system. The MATLAB command gives one possible representation.

Example 1) Consider the transfer-function system Y(s)/U(s) = 10s + 10/s3 + 6s2 + 5s + 10 There are many (again, infinitely many) possible state-space representations of this system. One possible representation is: x1 = 0 x2 = 0 x3 = -10 1 0 -5 0 1 -6 x1 x2 x3 0 10 -50

y = 0

x1 x2 x3

Another possible state-space representation (among infinitely many alternatives) is x1 = x2 = x3 = -6 1 0 -5 0 1 -10 0 0 x1 x2 x3 1 0 0

x1 y= 0 10 10 x2 + 0 u x3 MATLAB transforms the given transfer function into state-space representation by the following program: >> num = [10 10]; >> den = [1 6 5 10]; >> [A, B, C, D] = tf2ss(num,den)

MATLAB response: A= -6 -5 -10 1 0 0 0 1 0 B= 1 0 0 C= 0 10 10 D= 0 Exercise I: Consider the transfer function system: Y(s)/U(s) = (25.04s + 5.008)/(s3 + 5.03247s2 + 25.1026s + 5.008) Obtain a state-space representation of this system with MATLAB and write the state-space equation from MATLAB.

State-space to Transfer function To obtain the transfer function from state-space equations, use the command [num,den] = ss2tf(A,B,C,D,iu) Where iu must be specified for systems with more than one input. For example, if the system has three inputs (u1, u2, u3), then iu must be either 1, 2, or 3 where 1 implies u1, 2 implies u2, and 3 implies u3. If the system has only one input, then either [num,den] = ss2tf(A,B,C,D) Or [num,den] = ss2tf(A,B,C,D,1) Example 2) Obtain the transfer function of the system defined by the following state-space equations: x1 = 0 x2 = 0 x3 = -5.008 1 0 -25.1026 0 1 -5.03247 x1 x2 x3 0 25.04 u -121.005

x1 y = 1 0 0 x2 x3 The following MATLAB program should produce the transfer function: Y(s)/U(s) = (25.04s + 5.008)/(s3 + 5.03247s2 + 25.1026s + 5.008)

MATLAB Program: >> A = [0 1 0;0 0 1;-5.008 -25.1026 -5.03247]; >> B = [0;25.04;-121.005]; num = 0 -0.0000 25.0400 5.0080 den = 1.0000 5.0325 25.1026 5.0080 >> C = [1 0 0]; >> D = [0]; >> [num,den] = ss2tf(A,B,C,D) MATLAB Response: num = 0 -0.0000 25.0400 5.0080 den = 1.0000 5.0325 25.1026 5.0080 If the system involves one output but more than one input, use the command [num,den] = ss2tf(A,B,C,D,iu) This command converts the state-space system: . x = Ax + Bu y = Cx + Du to the transfer function system: Y(s)/Ui(s) = ith element of [C(sI A)-1B + D] Note that the scalar iu is an index into the inputs of the system and specifies which input is to be used for the response. Exercise II: Consider the system x1 = 0 x2 = -2 1 -3 x1 0 x2 x1 x2 + 1 0 0 1 u1 u2
5

u1 u2

y= 1

+ 0

which has two inputs and one output. Questions: - How many transfer functions are obtained for this system? - Use superposition to list how output/input the transfer functions relate. Once you answer the above questions, then create a MATLAB program to output your results. Record your transfer functions. Questions: - Is your MATLAB result consistent with what you predicted? Example 3) Consider a system with multiple inputs and multiple outputs. When the system has more than one output, the command [NUM, den] = ss2tf (A,B,C,D,iu) Produces transfer functions for all outputs to each input. The numerator coefficients are returned to matrix NUM with as many rows as there are outputs. x1 = 0 x2 = -25 1 y=0 0 1 1 -4 x1 x2 x1 x2 + 1 0 0 0 1 1 u1 u2 u1 u2

0 + 0

Questions: - How many transfer functions are obtained for this system? - Use superposition to list how output/input the transfer functions relate. Once you answer the above questions, then create a MATLAB program to output your results. Record your transfer functions. Questions: - Is your MATLAB result consistent with what you predicted?

You might also like