Labcontrol 5
Labcontrol 5
SUBMITTED BY
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
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
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
x' = Ax+Bu
simout
y = Cx+Du
Step State-Space To Workspace
Figure#5.5
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
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
x' = Ax+Bu
simout
y = Cx+Du
Step State-Space To Workspace
Figure#5.7
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
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
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