0% found this document useful (0 votes)
9 views6 pages

MATLAB Assignment 1

The document outlines an assignment for EEE-101 focusing on Control Systems Engineering using MATLAB. It includes tasks related to transfer functions, partial fraction expansion, inverse Laplace transforms, state-space representation, polynomial roots, and system characteristics. Additionally, it involves plotting step responses and performing block diagram reductions, along with similarity transformations and diagonalization of systems.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views6 pages

MATLAB Assignment 1

The document outlines an assignment for EEE-101 focusing on Control Systems Engineering using MATLAB. It includes tasks related to transfer functions, partial fraction expansion, inverse Laplace transforms, state-space representation, polynomial roots, and system characteristics. Additionally, it involves plotting step responses and performing block diagram reductions, along with similarity transformations and diagonalization of systems.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

EEE-101 - Control Systems Engineering

MATLAB and Control System Toolbox Assignment

1. Transfer Function and Zero-Pole-Gain Representation


1. Use the zpk command to create a transfer function with zeros at [], poles at [-1, -2, -2], and
a gain of 2. Display the transfer function.
1 F = zpk ([] , [ -1 , -2 , -2] , 2)

2. Convert the transfer function from part (1) to a numerator-denominator form using the tf com-
mand.
1 F_tf = tf ( F )

2: Partial Fraction Expansion


2
1. For the transfer function F (s) = (s+1)(s+2)2 , use the residue command to find the partial fraction

expansion. Identify the residues, poles, and direct terms.


1 numf = 2;
2 denf = poly ([ -1 , -2 , -2]) ;
3 [K , p , k ] = residue ( numf , denf )

2. Verify the partial fraction expansion by reconstructing the original transfer function from the
residues and poles.
1 [ numf_recon , denf_recon ] = residue (K , p , k )
2 F_recon = tf ( numf_recon , denf_recon )

3: Inverse Laplace Transform


3
1. Use the Symbolic Math Toolbox to find the inverse Laplace transform of F (s) = s(s2 +2s+5) .

1 syms s ;
2 f = ilaplace (3 / ( s * ( s ^2 + 2* s + 5) ) )
3 pretty ( f )

4: State-Space Representation
1. Define the state-space matrices and Convert state-space representation to a transfer function rep-
resented as a numerator and denominator in polynomial form, G(s) = num/den.
1 A = [0 , 1 , 0; 0 , 0 , 1; -9 , -8 , -7];
2 B = [7; 8; 9];
3 C = [2 , 3 , 4];
4 D = 0;
5 [ num , den ] = ss2tf (A ,B ,C , D )

2. Convert the state-space representation to a transfer function using the tf command.


1 F = ss (A ,B ,C , D )
2 F_tf = tf ( F )

3. Convert a transfer function to the state-space representation using the tf2ss command.
1 [A ,B ,C , D ] = tf2ss ( num , den )

1
5: Polynomial Roots and Multiplication
1. Find the roots of the polynomial 5s4 + 7s3 + 9s2 − 3s + 2 = 0 using the roots command.
1 P = [5 , 7 , 9 , -3 , 2];
2 rootsP = roots ( P )

2. Multiply the polynomials (s3 + 7s2 + 10s + 9) and (s4 − 3s3 + 6s2 + 2s + 1) using the conv command.
1 P = conv ([1 , 7 , 10 , 9] , [1 , -3 , 6 , 2 , 1])

6: Second-Order System Characteristics


1. For a second-order system with poles at −3 ± 7i, calculate the natural frequency (ωn ), damping
ratio (ζ), settling time (Ts ), peak time (Tp ), and percent overshoot (%OS).
1 p1 = [1 , 3+7 i ];
2 p2 = [1 , 3 -7 i ];
3 deng = conv ( p1 , p2 ) ;
4 omegan = sqrt ( deng (3) / deng (1) )
5 zeta = ( deng (2) / deng (1) ) / (2 * omegan )
6 Ts = 4 / ( zeta * omegan )
7 Tp = pi / ( omegan * sqrt (1 - zeta ^2) )
8 pos = 100 * exp ( - zeta * pi / sqrt (1 - zeta ^2) )

7: Plot the Step Response of Systems (Represented in State


Space)
1. We also can plot the step response of systems represented in state space using the step(T,t) com-
mand.
1 A = [0 , 1 , 0; 0 , 0 , 1; -24 , -26 , -9];
2 B = [0; 0; 1];
3 C = [2 , 7 , 1];
4 D = 0;
5 T = ss (A ,B ,C , D )
6 t = 0:0.1:10;
7 step (T , t )
8 grid on

8: Step Response of Multiple Systems


1. Create three transfer functions:
1 T1 = tf ([24.542] , [1 , 4 , 24.542])
2 T2 = tf ([245.42] , conv ([1 , 10] , [1 , 4 , 24.542]) )
3 T3 = tf ([73.626] , conv ([1 , 3] , [1 , 4 , 24.542]) )

2. Plot the step responses of all three systems on the same graph.
1 step ( T1 , T2 , T3 )
2 title ( ’ Step Responses of T1 ( s ) , T2 ( s ) , and T3 ( s ) ’)

2
9: Block Diagram Reduction
For the control system shown in Fig. 1, find the equivalent transfer function from R(s) to Y (s) using
block reduction method.

𝑅(𝑠) 2 −0.125𝑠 − 0.05437 𝑌(𝑠)


−1
− − 𝑠+2 10.23𝑠 2 + 12.59𝑠 + 0.02079

−𝑠

Figure 1

1. Solution via Series, Parallel, & Feedback Commands


1 ’ Solution via Series , Parallel , & Feedback Commands ’
2 numg1 =[ -1];
3 deng1 =[1];
4 numg2 =[0 2];
5 deng2 =[1 2];
6 numg3 = -0.125*[1 0.435];
7 deng3 = conv ([1 1.23] ,[10.226 0.0169]) ;
8 numh1 =[ -1 0];
9 denh1 =[0 1];
10 G1 = tf ( numg1 , deng1 ) ;
11 G2 = tf ( numg2 , deng2 ) ;
12 G3 = tf ( numg3 , deng3 ) ;
13 H1 = tf ( numh1 , denh1 ) ;
14 G4 = series ( G2 , G3 ) ;
15 G5 = feedback ( G4 , H1 ) ;
16 Ge = series ( G1 , G5 ) ;
17 ’T ( s ) via Series , Parallel , & Feedback Commands ’
18 T = feedback ( Ge ,1)

2. Solution via Algebraic Operations


1 ’ Solution via Algebraic Operations ’
2 numg1 =[ -1];
3 deng1 =[1];
4 numg2 =[0 2];
5 deng2 =[1 2];
6 numg3 = -0.125*[1 0.435];
7 deng3 = conv ([1 1.23] ,[10.226 0.0169]) ;
8 numh1 =[ -1 0];
9 denh1 =[0 1];
10 G1 = tf ( numg1 , deng1 ) ;
11 G2 = tf ( numg2 , deng2 ) ;
12 G3 = tf ( numg3 , deng3 ) ;
13 H1 = tf ( numh1 , denh1 ) ;
14 G4 = G3 * G2 ;
15 G5 = G4 /(1+ G4 * H1 ) ;
16 G5 = minreal ( G5 ) ;
17 Ge = G5 * G1 ;
18 ’T ( s ) via Algebraic Operations ’
19 T = Ge /(1+ Ge ) ;
20 T = minreal ( T )

3
3. Solution via Append & Connect Commands
1 ’ Solution via Append & Connect Commands ’
2 ’ G1 ( s ) =( - K1 ) *(1/( - K2s ) ) =1/ s ’
3 numg1 =[1];
4 deng1 =[1 0];
5 G1 = tf ( numg1 , deng1 )
6 ’ G2 ( s ) =( - K2s ) *(2/( s +2) ’
7 numg2 =[ -2 0];
8 deng2 =[1 2];
9 G2 = tf ( numg2 , deng2 )
10 ’ G3 ( s ) = -0.125( s +0.435) /(( s +1.23) ( s ^2+0.226 s +0.0169) ) ’
11 numg3 = -0.125*[1 0.435];
12 deng3 = conv ([1 1.23] ,[10.226 0.0169]) ;
13 G3 = tf ( numg3 , deng3 ) ;
14 System = append ( G1 , G2 , G3 )
15 input =1;
16 output =3;
17 Q =[1 -3 0;2 1 -3;3 2 0];
18 T = connect ( System ,Q , input , output ) ;
19 ’T ( s ) via Append & Connect Commands ’
20 T = tf ( T ) ;
21 T = minreal ( T )

10: Similarity Transformations


 
2 0 0
1. Perform a similarity transformation using the transformation matrix Pinv = 3 2 0.
 

1 4 5
1 Pinv = [2 , 0 , 0; 3 , 2 , 0; 1 , 4 , 5];
2 P = inv ( Pinv )
3 ’ Original ’
4 Ax = [0 , 1 , 0; 0 , 0 , 1; -2 , -5 , -7]
5 Bx = [0; 0; 1]
6 Cx = [1 , 0 , 0]
7 ’ Transformed ’
8 Az = Pinv * Ax * P
9 Bz = Pinv * Bx
10 Cz = Cx * P

11: Diagonalization of Systems


1. Diagonalize the system via Transformation and using the canon command.
1 A = [3 , 1 , 5; 4 , -2 , 7; 2 , 3 , 1];
2 B = [1; 2; 3];
3 C = [2 , 4 , 6];
4 [P , d ] = eig ( A )
5 ’ Via Transf ormation ’
6 Adt = inv ( P ) * A * P
7 Bdt = inv ( P ) * B
8 Cdt = C * P
9 ’ Via Canon Command ’
10 S = ss (A , B , C , 0)
11 Sp = canon (S , ’ modal ’)

4
Assignment

1. Find the Laplace transform of the following time functions:


(a) f (t) = 8t2 cos(3t + 45◦ )

(b) f (t) = 3te−2t sin(4t + 60◦ )

2. Find the Inverse Laplace transform of the following transfer functions:


(s2 + 3s + 10)(s + 5)
(a) G(s) =
(s + 3)(s + 4)(s2 + 2s + 100)
s3 + 4s2 + 2s + 6
(b) G(s) =
(s + 8)(s2 + 8s + 3)(s2 + 5s + 7)

3. Generate the transfer function:


5(s + 15)(s + 26)(s + 72)
G(s) = in the following ways:
s(s + 55)(s2 + 5s + 30)(s + 56)(s2 + 27s + 52)
(a) The ratio of factors

(b) The ratio of polynomials

4. Generate the partial fraction expansion of the following function:


104 (s + 5)(s + 70)
F (s) =
s(s + 45)(s + 55)(s2 + 7s + 110)(s2 + 6s + 95)

5. Find the state-space representation form for each of the systems shown in
Fig. 2.

Figure 2

Y (s)
6. Find the transfer function, G(s) = R(s)
, for each of the following systems
represented in state space:
a.
   
0 1 5 0 0
0 0 1 0 5
  
ẋ =  x +  r

0 0 0 1 8
−7 −9 −2 −3 2

5
h i
y= 1 3 6 6 x

b.
   
3 1 0 4 2 2
−3 5 −5 2 −1 7
   
   
 0 1 −1 2
ẋ =  x +
8 8 r
 
−7 6 −3 −4 0  5
   
−6 0 4 −3 1 4
h i
y = 1 −2 −9 7 6 x

Common questions

Powered by AI

To compute the inverse Laplace transform using MATLAB's Symbolic Math Toolbox, first, define the Laplace variable using 'syms s'. Then, use the 'ilaplace' function on the expression. For example, for the function F(s) = 3/(s*(s^2 + 2*s + 5)), you define 'f = ilaplace (3 / (s * (s^2 + 2*s + 5)))' to obtain the inverse Laplace transform in the time domain. The 'pretty' function can be used afterwards to display the result in a readable format .

To diagonalize a system matrix in MATLAB, use the 'eig' function to compute the eigenvectors and eigenvalues. For a matrix A, define the system and use '[P, D] = eig(A)' to get the transformation matrix P and the diagonal matrix D. To express the system in its diagonal form use 'Adt = inv(P) * A * P'. The transformed B and C matrices can be computed as 'Bdt = inv(P) * B' and 'Cdt = C * P'. This process transforms the system but retains its controllability and observability .

To find the partial fraction expansion of a transfer function in MATLAB, you use the 'residue' command. For example, for the transfer function F(s) = 2 / ((s+1)(s+2)^2), you define the numerator as 'numf = 2' and the denominator using 'denf = poly([-1, -2, -2])'. Then, use '[K, p, k] = residue(numf, denf)' to obtain the residues (K), poles (p), and direct terms (k) of the partial fraction expansion .

Performing a similarity transformation involves altering a system's state-space matrices A, B, C using a transformation matrix P. Given Pinv (an inverse transformation matrix), define P as 'P = inv(Pinv)'. For a state-space system with A = [0, 1, 0; 0, 0, 1; -2, -5, -7], perform the transformation with 'Az = Pinv * A * P', 'Bz = Pinv * Bx', where Bx is the input matrix, and 'Cz = Cx * P', where Cx is the output matrix .

To convert a state-space representation to a transfer function in MATLAB, define the state-space matrices A, B, C, and D. For instance, if A = [0, 1, 0; 0, 0, 1; -9, -8, -7], B = [7; 8; 9], C = [2, 3, 4], and D = 0, use '[num, den] = ss2tf(A, B, C, D)' to obtain the transfer function in polynomial form. Alternatively, use 'F = ss(A, B, C, D)' followed by 'F_tf = tf(F)' to convert it to transfer function form with the tf command .

In MATLAB, to plot the step responses of multiple systems simultaneously, define the transfer functions of each system, such as T1, T2, and T3 using the 'tf' command to define each system with its respective numerator and denominator. Use the 'step' command to plot these responses together: 'step(T1, T2, T3)'. This command displays the step responses all on the same graph, and using 'title('Step Responses of T1(s), T2(s), and T3(s)')' to label the plot appropriately .

From the poles of a second-order system, such as -3 ± 7i, you can derive the natural frequency (ωn), damping ratio (ζ), settling time (Ts), peak time (Tp), and percent overshoot (%OS). Use MATLAB commands like 'omegan = sqrt(deng(3) / deng(1))' for natural frequency, 'zeta = (deng(2) / deng(1)) / (2 * omegan)' for damping ratio, 'Ts = 4 / (zeta * omegan)' for settling time, 'Tp = pi / (omegan * sqrt(1 - zeta^2))' for peak time, and 'pos = 100 * exp(-zeta * pi / sqrt(1 - zeta^2))' for percent overshoot .

To convert a transfer function from a zero-pole-gain representation to a numerator-denominator form in MATLAB, the 'tf' command is used. For instance, if you have a transfer function with zeros at [], poles at [-1, -2, -2], and a gain of 2, you use the command 'F = zpk([], [-1, -2, -2], 2)' to represent it in zero-pole-gain form. Then, 'F_tf = tf(F)' converts it to numerator-denominator form, providing the transfer function representation in terms of its polynomial coefficients .

To find the roots of a polynomial in MATLAB, use the 'roots' command. For example, for the polynomial 5s^4 + 7s^3 + 9s^2 - 3s + 2, define it as 'P = [5, 7, 9, -3, 2]', then 'roots(P)' returns its roots. For polynomial multiplication, use the 'conv' command. To multiply (s^3 + 7s^2 + 10s + 9) and (s^4 - 3s^3 + 6s^2 + 2s + 1), define each as vectors and apply 'conv([1, 7, 10, 9], [1, -3, 6, 2, 1])' to get the resultant coefficients .

To perform block diagram reduction in MATLAB, define the transfer functions using commands like 'tf' for the blocks based on their numerators and denominators. Use 'series', 'parallel', and 'feedback' commands to connect these transfer functions based on their configuration. For example, use 'G4 = series(G2, G3)' to connect G2 and G3 in series, 'G5 = feedback(G4, H1)' to account for feedback, and finally 'Ge = series(G1, G5)' to connect in series with G1. Use 'T = feedback(Ge, 1)' to get the equivalent transfer function from R(s) to Y(s).

You might also like