Exercise # 4
Systems Generation, Retrieval and Interconnection Objective: At the end of this laboratory exercise, you should be able to characterize systems using different forms of systems representation, system transformation and systems interconnection. Tools Required: 1. Computer Workstation 2. MATLAB Software ( )
The linear differential equation defined by ∑
= ( ) when converted to its equivalent
Laplace Transforms can be written as ( ) = ( ) ( ), where C(s), R(s) and G(s) are the output, input and transfer function respectively. Thus, the system can be characterized by its transfer function ( ) =
( ) ( )
. The transfer function is the Laplace transform of the impulse response g (t). The transfer function ( ) =
( ) ( )
can also be written ( ) = (
(
)(
)(
)(
)(
)…( )…(
)
)
where z, p, and K are the zeroes, poles and gain respectively. The modern control system representation is done in the time-domain. It is called the statespace representation of a system in matrix form ̇ = + and = + where = state vector ̇ = derivative of state vector with respect to time = output vector = input or control vector = system matrix = input matrix = output matrix = feedforward matrix The matrix equations ̇
̇
=
−1 −1⁄2
1 0
+
0 1⁄2
( ) and
= [1 0]
represents a
second – order system. A system can also be represented by its frequency response in continuous form or at discrete points.
Frequency (Hz) 100 200 400
Response - 0.091 + j0.7 - 0.0543 + j0.043 - 0.0543 + j0.065
MATLAB Commands Review: Generation of LTI models 1. Transfer functions SYS = tf (NUM, DEN) creates a continuous-time transfer function SYS with numerator(s) coefficients, NUM and denominator(s) coefficients, DEN. The output SYS is a tf object. 2. Zero – pole – gain SYS = zpk (Z, P, K) creates a continuous-time zero-pole-gain (ZPK) model SYS with zeroes vector Z; poles vector P, and gain K. The output SYS is a zpk object. 3. Frequency Response Data (FRD) models are useful for storing frequency responses of LTI systems, including experimental response data. Creation: SYS = frd (RESPONSE, FREQS) creates an frd model SYS with response data in the RESPONSE vector at frequency points in FREQS vector. The output SYS is an frd model. 4. State-space SYS = ss (A, B, C, D) creates a continuous-time state-space (SS) model SYS with matrices A, B, C, D. The output SYS is anss object. You can set D=0 to mean the zero matrix of appropriate dimensions. Data Retrieval [NUM, DEN]=tfdata (SYS,’v’) returns the numerator(s) coefficients and denominator(s) coefficients of the transfer function SYS. For a transfer function with NY outputs and NU inputs, NUM and DEN are NY-by-NU cell arrays where the (I, J) entry specifies the transfer function from input J to output I. SYS is first converted to transfer function, if necessary. [Z, P, K] = zpkdata (SYS,’v’) returns the zeroes, poles, and gain for each I/O channel of the LTI model SYS. The cell arrays Z, P and the matrix K have as many rows as outputs and as many columns as inputs, and their (I, J) entries specify the zeroes, poles, and gain of the transfer function from input J to output I. SYS is first converted to zero – pole – gain format if necessary. [A, B, C, D] = ssdata (SYS) retrieves the matrix data A, B, C, and D for the state – space model SYS. If SYS is not a state-space model, it is first converted to a state – space representation. [RESPONSE, FREQ] = frdata (SYS) returns the response data and frequency samples of the frequency response data (FRD) model SYS.
Note: applicable only to FRD data!!! System Conversion TF2SS Transfer function to state – space conversion. [A, B, C, D] = TF2SS (NUM, DEN) calculates the state – space representation: ̇= + ̇= + of the system: ( ) ( ) = ( ) SS2TF State – space to transfer function conversion. [NUM, DEN] = SS2TF (A, B, C, D, iu) calculates the transfer function: ( ) ( ) = ) + = ( − ( ) of the system: ̇= + ̇= + from the iu’th input. Vector DEN contains the coefficients of the denominator in descending powers of s. The numerator coefficients are returned in matrix NUM with as many rows as there are outputs y. TF2ZP Transfer function to zero – pole conversion. [Z, P, K] = TF2ZP (NUM, DEN) finds the zeroes, poles, and gains: ( − )( − ) … ( − ) ( ) = ( − )( − ) … ( − ) from a SIMO transfer function in polynomial form: ( ) ( ) = ( ) ZP2TF Zero – pole to transfer function conversion. [NUM, DEN] = ZP2TF (Z, P, K) forms the transfer function: ( ) ( ) = ( ) given a set of zero locations in vector Z, a set of pole locations in vector P, and a gain in scalar K. Vectors NUM and DEN are returned with numerator and denominator coefficients in descending powers of s. ZP2SS Zero – pole to state – space conversion. [A, B, C, D] = ZP2SS (Z, P, K) calculates a state – space representation: ̇= + ̇= +
for a system given a set of pole locations in column vector P, a matrix Z with the zero locations in as many columns as there are outputs, and the gains for each numerator transfer function in vector K. The A, B, C, D matrices are returned in block diagonal form. The poles and zeroes must correspond to a proper system. If poles or zeroes are complex, they must appear in complex conjugate pairs, i.e., the corresponding transfer function must be real. SS2ZP State – space to zero – pole conversion. [Z, P, K] = SS2ZP (A, B, C, D, IU) calculates the transfer function in factored form: ( − )( − ) … ( − ) ( ) = ( − ) + = ( − )( − ) … ( − ) of the system: ̇= + ̇= + from the single input IU. The vector P contains the pole locations of the denominator of the transfer function. The numerator zeroes are returned in the columns of matrix Z with as many columns as there are outputs y. The gains for each numerator transfer function are returned in column vector K. Connecting systems SYS = series (SYS1, SYS2) connects two LTI models P1 and P2 are LTI systems in series.
SYS = parallel (SYS1, SYS2) connects the two LTI models P1 and P2 in parallel.
SYS = feedback (P1, P2, SIGN) computes an LTI model SYS for the closed – loop feedback system. Negative feedback is assumed and the resulting system SYS maps r to c. To apply positive feedback, use the syntax SYS = feedback (P1, P2, +1).
Laboratory Report Rubric
Name of Student: ____________________________________________________________ Title of Exercise:_____________________________________________________________ Criteria
Appearance/Organization /Completeness of Laboratory Report (X0.5)
Accuracy of Results/Data Gathered (x2)
Novice (0 – 4) Untidy Report. Submitted Laboratory report does not follow the given format, not organized and not original but with complete required contents Presented an incorrect result/data and incomplete.
Average (5 – 7)
Expert (8 – 10)
Neat Report. Submitted Laboratory report follows the given format, organized but with complete required contents
Neat and wellpresented report. Submitted Laboratory report follows the given format, organized, original and with complete required contents.
Presented result/data incomplete.
correct but
Discussion of Results (X2.5)
Ideas are not in reference to the result/data gathered during experiment. Not clear, incomplete and too short.
Ideas are in reference to result/data gathered during experiment. Clear, but not complete and too short.
Conclusion (X3)
Ideas are inappropriate to the experiment. Not clear, incomplete and too short. Failed to link the results of the experiment with a general theorem or law.
Ideas are somehow appropriate to the experiment that has been performed. Clear but not complete and too short. A general theorem or law was cited that supports the data gathered.
Use of Language (X2)
Inappropriate use of words. Poor grammar and bad sentence construction. Cannot express ideas clearly.
Appropriate choice of words. Few grammatical and syntax errors. Can express ideas.
Score
Presented correct result/data and complete. Ideas are taken from the result/data gathered during the experiment. Very clear, complete and sufficient to form a discussion. Ideas are very much appropriate to the experiment that has been performed. Very clear, complete and sufficient to form a conclusion. A general theorem or law is formulated and discussed reasonably well to explain the results of the experiment. Uses rich and imaginative language. Excellent grammar and sentence construction. Ideas are expressed clearly and precisely. TOTAL
/100
___________________________________ Signature over Printed Name of Instructor
Exercise # 4
Systems Generation, Retrieval and Interconnection Laboratory Data Sheet Student Name (LN, FN, MI) Date of Performance SKED CODE/SUBJECT CODE Name of Instructor Signature of Instructor 1. Generate the following systems: a. sysa is a system with transfer function ( ) =
5 +8 +5 +6
Commands used: sys lagmay = tf([5 0 8],[1 5 6]) _____________________________________________________________________ _____________________________________________________________________ 5 s^2 + 8 MATLAB Output: sys lagmay = ------------_____________________________________________________________________ s^2 + 5 s + 6 b. sysb is a system with a gain of 15, poles at s = 3 and s = -7 and zeroes at s = - 4 and s = 1. Commands used: sys lagmay = zpk ([-4 1],[3 -7],15) _____________________________________________________________________ _____________________________________________________________________ 15 (s+4) (s-1) MATLAB Output: sys lagmay = ------------------_____________________________________________________________________ (s-3) (s+7) 0 1 0 c. sysc is a system with matrices = , = , = [1 0] and D = 0. − 5 − 2 3 Commands used: _____________________________________________________________________ _____________________________________________________________________ MATLAB Output: _____________________________________________________________________
d. sysd is a system with a set of frequencies with corresponding system responses Frequency (Hz) 1000 2000 3000
Response - 0.91 + j0.7 - 0.54 + j0.04 - 0.43 + j0.65
Commands used: _____________________________________________________________________ _____________________________________________________________________ MATLAB Output: _____________________________________________________________________ e. sys1 is a system with transfer function 2 −6 ( ) = +5 −3 Commands used: sys lagmay = tf([2 0 -6],[1 5 -3]) _____________________________________________________________________ _____________________________________________________________________ 2 s^2 - 6 MATLAB Output: sys lagmay = ---------------_____________________________________________________________________ s^2 + 5 s - 3 f. sys2 is a system with a gain of 5, poles at s = 2 and s = - 5 and zeroes at s = - 2 and s = 3. Commands used: sys lagmay = zpk ([-2 3],[2 -5],5) _____________________________________________________________________ _____________________________________________________________________ 5 (s+2) (s-3) MATLAB Output: sys lagmay = ---------------_____________________________________________________________________ (s-2) (s+5) 2. Generate the system given by the transfer function: 5 −8 +3 ( ) = 2 −4 −4 Commands used: sys lagmay = tf([5 -8 3],[2 -4 -4]) ________________________________________________________________________ ________________________________________________________________________ 5 s^2 - 8 s + 3 MATLAB Output: sys lagmay = -------------------________________________________________________________________________ 2 s^2 - 4 s - 4 a. Retrieve the numerator and denominator of the system. Commands used: [num, den]=tfdata (sys,'v') _____________________________________________________________________ _____________________________________________________________________ num = 5 -8 3 MATLAB Output: den = 2 -4 -4
_____________________________________________________________________ b. Retrieve the gain, poles and zeroes of the system. Commands used: [z,p,k]=zpkdata(sys,'v') _____________________________________________________________________ _____________________________________________________________________ z = 1 p = 2.7321 k = 2.5 MATLAB Output: 6 -0.7321 _____________________________________________________________________ c. Retrieve the state space parameters of the system. Commands used: [A,B,C,D] = ssdata(sys) _____________________________________________________________________ _____________________________________________________________________ a = 2 2 b = 2 c = 0.5 3.25 d = 2.5 MATLAB Output: 1 0 0 _____________________________________________________________________ d. Retrieve the frequency response data of the system. Commands used: _____________________________________________________________________ _____________________________________________________________________ MATLAB Output: _____________________________________________________________________ 3. Generate the system given by the transfer function: 3 −3 +1 ( ) = −2 −2 Commands used: sys lagmay = tf ([3 -3 1],[1 -2 -2]) ________________________________________________________________________ ________________________________________________________________________ 3 s^2 - 3 s + 1 MATLAB Output: sys lagmay = -----------------________________________________________________________________________ s^2 - 2 s - 2 a. Retrieve the numerator and denominator of the system. Commands used: [num, den]=tfdata (sys,'v') _____________________________________________________________________ _____________________________________________________________________ num = 3 -3 1 MATLAB Output: den = 1 -2 -2 _____________________________________________________________________ b. Retrieve the gain, poles and zeroes of the system. Commands used: [z,p,k]=zpkdata(sys,'v') _____________________________________________________________________ _____________________________________________________________________ MATLAB Output:
z = 0.5000 + 0.2887i 0.5000 - 0.2887i
p = 2.7321 -0.7321
k= 3
Commands used: ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ Matlab Output: ________________________________________________________________________ ________________________________________________________________________ c.
Commands used: ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ Matlab Output: ________________________________________________________________________ ________________________________________________________________________ d.
Commands used: ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ Matlab Output: ________________________________________________________________________ ________________________________________________________________________ e.
Commands used: ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ Matlab Output: ________________________________________________________________________ ________________________________________________________________________ f.
Use the state values at 1(c) Commands used: ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ Matlab Output: ________________________________________________________________________ ________________________________________________________________________ 5. Create a Matlab M – File [sys1, sys2, sys3, num, den, zero, pole, gain, A, B, C, D] = seriesrlc(R, L, C)
v(t)
i(t)
( ) =
( ) ( )
where: sys = tf object num = numerator coefficients den = denominator coefficients zero = zeroes of the system pole = poles of the system gain = gain of the system A, B, C, D = state – space matrices sys1 = ss object sys2 = zpk object Matlab M – File: _________________________________________________________________________________ _________________________________________________________________________________ _________________________________________________________________________________ _________________________________________________________________________________ _________________________________________________________________________________ _________________________________________________________________________________ _________________________________________________________________________________
6. Test the function seriesrlc using R = 25Ω, L = 10mH and C = 10μF Matlab Command: ________________________________________________________________________ Matlab Outputs:
7. Test the function seriesrlc using R = 1Ω, L = 1mH and C = 1μF Matlab Command: ________________________________________________________________________ Matlab Outputs: