Control Lab 05
Control Lab 05
Control Lab 05
Section: _______________________________EEE 6A
Abbottabad Campus
Task 1:Now students have to implement this state space model of RLC circuit in SIMULINK. Use
applied voltage 10V, 5V and 3V. L = ¼ H, C = 4/3 F and R = 1Ω.
Mechanical System
A translational mechanical system is given in Figure 4.2
Solution:-
When voltage is = 3v
clc;
clear all;
close all;
L=1/4; %Inductance
C=4/3; %Capacitance
R=1; %Resistance
A=[0,1/C;-1/L,-R/L];
B=[0;1/L];
C=[1,0]
D=[3] %Applied Voltage
[n,d]=ss2tf(A,B,C,D)
a=tf(n,d)
impulse(a)
figure
step(a)
Output Figures:-
Impulse Response
0.6
0.5
0.4
Amplitude
0.3
0.2
0.1
0
0 1 2 3 4 5 6 7
Time (seconds)
Step Response
4
3.9
3.8
3.7
3.6
Amplitude
3.5
3.4
3.3
3.2
3.1
3
0 1 2 3 4 5 6 7
Time (seconds)
When voltage is = 5v
clc;
clear all;
close all;
L=1/4; %Inductance
C=4/3; %Capacitance
R=1; %Resistance
A=[0,1/C;-1/L,-R/L];
B=[0;1/L];
C=[1,0]
D=[5] %Applied Voltage
[n,d]=ss2tf(A,B,C,D)
a=tf(n,d)
impulse(a)
figure
step(a)
Output Figures:-
Impulse Response
0.6
0.5
0.4
Amplitude
0.3
0.2
0.1
0
0 1 2 3 4 5 6 7
Time (seconds)
Step Response
6
5.9
5.8
5.7
5.6
Amplitude
5.5
5.4
5.3
5.2
5.1
5
0 1 2 3 4 5 6 7
Time (seconds)
When voltage is = 10v
clc;
clear all;
close all;
L=1/4; %Inductance
C=4/3; %Capacitance
R=1; %Resistance
A=[0,1/C;-1/L,-R/L];
B=[0;1/L];
C=[1,0]
D=[10] %Applied Voltage
[n,d]=ss2tf(A,B,C,D)
a=tf(n,d)
impulse(a)
figure
step(a)
Output Figures:-
Impulse Response
0.6
0.5
0.4
Amplitude
0.3
0.2
0.1
0
0 1 2 3 4 5 6 7
Time (seconds)
Step Response
11
10.9
10.8
10.7
10.6
Amplitude
10.5
10.4
10.3
10.2
10.1
10
0 1 2 3 4 5 6 7
Time (seconds)
Task 2: Students have to 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.
Solution:-
Code:-
clc;
clear all;
close all;
M=1.2;
fv=3;
K=5;
A=[0 1;-K/M -fv/M];
B=[0;1/M];
C=[1 0];
D=[1];
[NUM,DEN]=ss2tf(A,B,C,D,1);
a=tf(NUM,DEN)
impulse(a)
legend('impulse')
grid on
figure
step(a)
legend('step')
grid on
Output Figures:-
Impulse Response
0.25
impulse
0.2
0.15
Amplitude
0.1
0.05
-0.05
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
Time (seconds)
Step Response
1.25
step
1.2
1.15
Amplitude
1.1
1.05
1
0 0.5 1 1.5 2 2.5 3 3.5 4
Time (seconds)
Task 3:For the rotational mechanical system given in Figure 4.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.
Solution:-
Code:-
clc;
clear all;
close all;
%Given Values D1 = D2= J1= J2= K = 1
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=[1];
[NUM,DEN]=ss2tf(A,B,C,D,1);
a=tf(NUM,DEN)
impulse(a)
legend('impulse')
grid on
figure
step(a)
legend('step')
grid on
Output Figures:-
Impulse Response
0.6
impulse
0.5
0.4
Amplitude
0.3
0.2
0.1
-0.1
0 2 4 6 8 10 12
Time (seconds)
Step Response
250
step
200
150
Amplitude
100
50
0
0 50 100 150 200 250 300 350 400
Time (seconds)