Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Objectives Students should be able to use basic MATLAB commands for control s

ID: 2291553 • Letter: 1

Question

1. Objectives Students should be able to use basic MATLAB commands for control systems engineering. 2. System Representations Find a state space represent by typing A"[0 1 0; 001;-4-3-2); B 2: 3: 1 C-[2 3 51; sys ss (A, B, C, D) Find the A, B,C, D matrices by typing sys.a sys.b sys. ? sys.d We can use tf or ss2tf to convert a state-space representation into a transfer function Gi-tf (sys) or [num den] -ss2tf (A, B,C,D) Gl-tf (num, den) We can also convert a transfer function into a state-space representation num [18 50 58]; den[1 2 3 41; A B C D-tf2ss (num, den) or H1ss (G1) Compare the answers with the A, B, C, D matrices you created. We can plot the step response of a system using step (Note that 1 is a state-space representation not a transfer function) step (H1) stepinfo returns step response characteristics. For example stepinfo (H1) will return

Explanation / Answer

Problem 1:

The following is the MATLAB code to find state space representation:

(a)

MATLAB code:

>> num=[1 5];
>> den=[1 2 10 2];
>> [A B C D]=tf2ss(num,den)

MATLAB output:

A =

-2 -10 -2
1 0 0
0 1 0


B =

1
0
0


C =

0 1 5


D =

0

(b)

MATLAB code:

>> num=[1 3 2];
>> den=[1 4 7];
>> [A B C D]=tf2ss(num,den)

MATLAB output:

A =

-4 -7
1 0


B =

1
0


C =

-1 -5


D =

1

Problem 2:

(a)

MATLAB code:

>> A=[0 1 0;0 0 1;-3 -2 -5];
>> B=[0;0;10];
>> C=[1 0 0];
>> D=0;
>> [num den]=ss2tf(A,B,C,D);

>> G=tf(num, den)

MATLAB output:

G =

10
---------------------
s^3 + 5 s^2 + 2 s + 3

Continuous-time transfer function.

(b)

MATLAB code:

>> A=[2 -3 -8;0 5 3;-3 -5 -4];
>> B=[0;1;2];
>> C=[1 3 0];
>> D=0;
>> [num den]=ss2tf(A,B,C,D);
>> G=tf(num, den)

MATLAB output:

G =

3 s^2 + 5 s - 42
------------------------
s^3 - 3 s^2 - 27 s + 103

Continuous-time transfer function.