-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfrs_hdd.m
94 lines (94 loc) · 2.53 KB
/
frs_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
84
85
86
87
88
89
90
91
92
93
94
% Frequency responses of the Hard Disk Drive Servo System
%
sim_hdd
clp = lft(sim_ic,K,1,1);
%
% closed-loop Bode plot
ref_loop = clp(1,1);
w = logspace(2,5,400);
figure(1)
bode(ref_loop.Nominal,'r-',ref_loop,'b--',w), grid
title('Closed-loop Bode plot')
legend('Nominal system','Random samples')
%
% output sensitivity to disturbance
sen_loop = clp(1,2);
w = logspace(-1,5,400);
figure(2)
bodemag(sen_loop.Nominal,'r-',sen_loop,'b--',w), grid
title('Output sensitivity to disturbance')
legend('Nominal system','Random samples')
%
% output sensitivity to noise
noise_loop = clp(1,3);
w = logspace(1,5,400);
figure(3)
bodemag(noise_loop.Nominal,'r-',noise_loop,'b--',w), grid
title('Output sensitivity to noise')
legend('Nominal system','Random samples')
%
% sensitivity of the control effort to the reference
ref_u = clp(2,1);
w = logspace(0,5,400);
figure(4)
bodemag(ref_u.Nominal,'r',ref_u,'b--',w), grid
title('T_{ur} magnitude plot')
legend('Nominal system','Random samples')
%
% sensitivity of the control effort to the disturbance
dist_u = clp(2,2);
w = logspace(0,5,400);
figure(5)
bodemag(dist_u.Nominal,'r',dist_u,'b--',w), grid
title('T_{ud} magnitude plot')
legend('Nominal system','Random samples')
%
% sensitivity of the control effort to the noise
noise_u = clp(2,3);
w = logspace(0,5,400);
figure(6)
bodemag(noise_u.Nominal,'r',noise_u,'b--',w), grid
title('T_{un} magnitude plot')
legend('Nominal system','Random samples')
%
% controller frequency response
w = logspace(-1,6,400);
figure(7)
bode(K,'r',w), grid
title('Controller Bode plot')
%
% open-loop frequency response
L = G(1,2)*K;
w = logspace(0,5,400);
figure(8)
bode(L.Nominal,'r-',L,'b--',w), grid
title('Open-loop Bode plot')
legend('Nominal system','Random samples')
%
wts_hdd
systemnames = ' G Wm Wn ';
inputvar = '[ ref; dist; noise; control ]';
outputvar = '[ G(1)-Wm; ref-G(1); ref-G(1)-Wn ]';
input_to_G = '[ dist; control ]';
input_to_Wm = '[ ref ]';
input_to_Wn = '[ noise ]';
sys = sysic;
%
% error frequency response
clp = lft(sys,K,1,1);
err_loop = clp(2,1);
w = logspace(1,5,400);
figure(9)
bodemag(err_loop.Nominal,'r',err_loop,'b--',w), grid
title('Error frequency response')
legend('Nominal system','Random samples')
%
% frequency response of the difference between the
% closed-loop system and the model
clp = lft(sys,K);
dif_loop = clp(1,1);
w = logspace(0,6,400);
figure(10)
bodemag(dif_loop.Nominal,'r',dif_loop,'b--',w), grid
title('System-model difference plot')
legend('Nominal system','Random samples')