0% found this document useful (0 votes)
3 views

Labcontrol 5

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Labcontrol 5

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

Lab Title” State Space Modeling of Systems”

Course Title : Control Systems


Course Code : EEE325
Class : BEE-6A
Teacher’s Name: Dr.Uzair Khan

SUBMITTED BY

Babar Ali : SP15-BEE-021


Date : October10, 2017

COMSATS Institute of Information Technology


Abbottabad
Task 1

Implement state space model of RLC circuit in SIMULINK and compare result with task 4
of lab 2. Use applied voltage 10V, 5V and 3V. L = ¼ H, C = 4/3 F and R = 1Ω.

Code in MATLAB

In Table#5.1 Matlab Code is given for the Task#1


A=[-4 -4; 3/4 0]
B=[4 ; 0]
C=[1 0; 0 1]
D=[0;0]
sys = ss(A,B,C,D)
step(sys)
grid on
Table#5.1

Command Window Results

In Table#5.2 Command window results are shown


A=
-4.0000 -4.0000
0.7500 0
B=
4
0
C=

1 0
0 1
D=

0
0
sys =
a=
x1 x2
x1 -4 -4
x2 0.75 0
b=
u1
x1 4
x2 0
c=
x1 x2
y1 1 0
y2 0 1
d=
u1
y1 0
y2 0
Continuous-time state-space model.

Table#5.2

Graphs

 For Voltage=1V

Figure#5.1
 For V=3V

Step Response
2.5

To: Out(1) 1.5

0.5
Amplitude

0
3

2.5

2
To: Out(2)

1.5

0.5

0
0 1 2 3 4 5 6 7 8
Time (seconds)

Figure#5.2
 For V=5V

Step Response
4

3
To: Out(1)

1
Amplitude

0
5

4
To: Out(2)

0
0 1 2 3 4 5 6 7 8
Time (seconds)

Figure#5.3
 For V=10V

Step Response
8

To: Out(1)
4

2
Amplitude

0
10

8
To: Out(2)

0
0 1 2 3 4 5 6 7 8
Time (seconds)

Figure#5.4
Simulink

In Figure#5.5 Simulink is shown.

x' = Ax+Bu
simout
y = Cx+Du
Step State-Space To Workspace

Figure#5.5

Simulink Results for Task#1

In Figure 5.6(A) and Figure 5.6(B) Simulink results are shown.

0.8 1

0.9
0.7
0.8
0.6
0.7

0.5 0.6

0.4 0.5

0.4
0.3
0.3
0.2
0.2

0.1 0.1

0 0
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10

Figure#5.6(A) Figure#5.6(B)
Task#2

write the state space model and then simulate the system using state space and plot the position response
of the system using step input, where M = 1.2, v = 3 and K = 5 and fill the graph in figure 3. And write
comparison for response achieved with transfer function.

Code

In Table#5.3 Matlab Code is given for the Task#2


A=[0 1; -5/1.2 -2.5]
B=[0 ; 1/1.2]
C=[1 0; 0 1]
D=[0;0]
sys = ss(A,B,C,D)
step(sys)
grid on
Table#5.3

Command Window Results

In Table#5.4 Command window results are shown


A=
0 1.0000
-4.1667 -2.5000
B=
0
0.8333
C=
1 0
0 1

D=

0
0
sys =

a=
x1 x2
x1 0 1
x2 -4.167 -2.5
b=
u1
x1 0
x2 0.8333
c=
x1 x2
y1 1 0
y2 0 1
d=
u1
y1 0
y2 0

Table#5.4

Graph

Step Response
0.25

0.2
To: Out(1)

0.15

0.1

0.05
Amplitude

0
0.3

0.2
To: Out(2)

0.1

-0.1
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
Time (seconds)
Simulink

Simulink for Task#2 is shown in Figure#5.7

x' = Ax+Bu
simout
y = Cx+Du
Step State-Space To Workspace

Figure#5.7

Simulink Results for Task#2

Graphs of Simulink are shown in Figure#5.8(A) and Figure#5.8(B)

0.25 0.3

0.25
0.2

0.2

0.15
0.15

0.1
0.1

0.05

0.05
0

0 -0.05
0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10

Figure#5.8(A) Figure#5.8(B)
Task 3

For the rotational mechanical system given in figure 3, Find the state space model of the system. Plot
the step response θ2(t) in figure 5 where D1 = D2 = J1 = J2 = K = 1. And write comparison for response achieved
with transfer function.

Code

In Table#5.5 Matlab Code is given for the Task#3


A=[0 1 0 0; -1 -1 1 0; 0 0 0 1; 1 0 -1 -1]
B=[0;1;0;0]
C=[ 0 0 1 0]
D=[0]
sys = ss(A,B,C,D)
step(sys); grid on
Table#5.5

Command Window Results

In Table#5.6 Command window results are shown


A=
0 1 0 0 -1 -1 1 0
0 0 0 1
1 0 -1 -1
B=
0
1
0
0
C=
0 0 1 0

D=
0

sys =

a=
x1 x2 x3 x4 x1 0 1 0 0 x2 -1 -1 1 0 x3 0 0 0 1
x4 1 0 -1 -1

b=
u1
x1 0
x2 1
x3 0
x4 0
c=
x1 x2 x3 x4 y1 0 0 1 0
d=
u1
y1 0

Table#5.6
Graphs

Step Response
60

50

40
Amplitude

30

20

10

0
0 20 40 60 80 100 120
Time (seconds)

Figure#5.9

Simulink

Simulink Result for Task#3 is shown in Figure#5.10

4.5

3.5

2.5

1.5

0.5

0
0 1 2 3 4 5 6 7 8 9 10

Figure#5.10

You might also like