-
Notifications
You must be signed in to change notification settings - Fork 0
/
dlp_hdd.m
58 lines (58 loc) · 1.62 KB
/
dlp_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
% Generate the open-loop connection for the
% discrete-time Hard Disk Drive Servo System
%
% discretization interval
Ts = input ('Enter sampling period Ts = ');
%
% Disk Drive Servo System model
mod_hdd
%
% construct performance weighting function
dwt_hdd
%
% open-loop connection with the weighting function
systemnames = ' G Wm Wn Wp Wu ';
inputvar = '[ ref; dist; noise; control ]';
outputvar = '[ Wp; Wu; ref-G(1)-Wn ]';
input_to_G = '[ dist; control ]';
input_to_Wm = '[ ref ]';
input_to_Wn = '[ noise ]';
input_to_Wp = '[ G(1) - Wm ]';
input_to_Wu = '[ control ]';
sys_ic = sysic;
%
% discrete-time model
[M,Delta] = lftdata(sys_ic);
M_d = c2d(M,Ts);
dsys_ic = lft(Delta,M_d);
%
% frequency response of the discrete-time plant
[M,Delta] = lftdata(G);
M_d = c2d(M,Ts);
G_d = lft(Delta,M_d);
w = logspace(2,log10(pi/Ts),400);
figure(1)
bode(G(1,2).NominalValue,'b-',G_d(1,2).NominalValue,'r--',w), grid
title('Bode plots of continuous-time and discrete-time plants')
legend('Continuous-time plant','Discrete-time plant')
%
G_d30 = usample(G_d,30);
w = logspace(2,log10(pi/Ts),400);
figure(2)
bode(G_d(1,2).NominalValue,'r-',G_d30(1,2),'b-.',w), grid
title('Bode plot of the uncertain discrete-time plant')
legend('Nominal system','Random samples')
%
% performance weighting frequency response
w = logspace(-2,log10(pi/Ts),400);
Wpi_d = c2d(1/Wp,Ts);
figure(3)
bodemag(Wpi_d,'r',w), grid
title('Inverse Performance Weighting Function')
%
% control weighting frequency response
w = logspace(-2,log10(pi/Ts),400);
Wu_d = c2d(Wu,Ts);
figure(4)
bodemag(Wu_d,'r',w), grid
title('Control Weighting Function')