-
Notifications
You must be signed in to change notification settings - Fork 0
/
mcs_hdd.m
83 lines (83 loc) · 2.15 KB
/
mcs_hdd.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
% Transient responses of the closed-loop system
% for random values of the uncertain parameters
%
sim_hdd
clp = lft(sim_ic,K,1,1);
%
% response to the reference
r = 1.2; % 1 track --> 1.2 V
ti = 0.000001; % time increment
tfin = 0.005; % final time value
time = 0:ti:tfin;
nstep = size(time,2);
ref(1:nstep) = r;
dist(1:nstep) = 0.0;
noise(1:nstep) = 0.0;
nsample = 30;
clp_30 = usample(clp,nsample);
for i = 1:nsample
[y,t] = lsim(clp_30(1:2,1:3,i),[ref',dist',noise'],time);
yr = y(:,1);
err = ref' - yr; % PES in volts
errm = err/r; % PES in tracks
figure(1)
plot(t,errm,'b-')
hold on
ur = y(:,2);
figure(2)
plot(t,ur,'r-')
axis([0 0.0005 -0.6 1.4])
hold on
end
figure(1)
grid
title('Closed-loop transient response')
xlabel('Time (secs)')
ylabel('Position Error Signal (tracks)')
hold off
figure(2)
grid
title('Control action, due to reference')
xlabel('Time (secs)')
ylabel('u (V)')
hold off
clear ref, clear dist, clear noise
%
% response to the disturbance
r = 1.2; % 1 track --> 1.2 V
ti = 0.000001; % time increment
tfin = 0.005; % final time value
time = 0:ti:tfin;
nstep = size(time,2);
ref(1:nstep) = 0.0;
dist(1:nstep) = 0.0005; % Td = 0.0005 N.m
noise(1:nstep) = 0.0;
nsample = 30;
clp_30 = usample(clp,nsample);
for i = 1:nsample
[y,t] = lsim(clp_30(1:2,1:3,i),[ref',dist',noise'],time);
yd = y(:,1);
err = ref' - yd; % PES in volts
errm = err/r; % PES in tracks
figure(3)
plot(t,errm,'b-')
hold on
ud = y(:,2);
figure(4)
plot(t,ud,'r-')
axis([0 0.0005 -0.02 0.01])
hold on
end
figure(3)
grid
title('Transient response to disturbance')
xlabel('Time (secs)')
ylabel('Position Error Signal (tracks)')
hold off
figure(4)
grid
title('Control action due to disturbance')
xlabel('Time (secs)')
ylabel('u (V)')
hold off
clear ref, clear dist, clear noise