@@ -46,8 +46,9 @@ def test_siso1():
46
46
plt .figure (1 )
47
47
plt .subplot (3 ,3 ,1 )
48
48
plt .semilogx (omega , DM , label = '$\\ alpha$' )
49
+ plt .ylabel ('Disk Margin (abs)' )
49
50
plt .legend ()
50
- plt .title ('Disk Margin ' )
51
+ plt .title ('S-Based Margins ' )
51
52
plt .grid ()
52
53
plt .xlim ([omega [0 ], omega [- 1 ]])
53
54
plt .ylim ([0 , 2 ])
@@ -57,7 +58,7 @@ def test_siso1():
57
58
plt .semilogx (omega , GM , label = '$\\ gamma_{m}$' )
58
59
plt .ylabel ('Gain Margin (dB)' )
59
60
plt .legend ()
60
- plt .title ('Gain-Only Margin' )
61
+ # plt.title('Gain-Only Margin')
61
62
plt .grid ()
62
63
plt .xlim ([omega [0 ], omega [- 1 ]])
63
64
plt .ylim ([0 , 40 ])
@@ -67,10 +68,11 @@ def test_siso1():
67
68
plt .semilogx (omega , PM , label = '$\\ phi_{m}$' )
68
69
plt .ylabel ('Phase Margin (deg)' )
69
70
plt .legend ()
70
- plt .title ('Phase-Only Margin' )
71
+ # plt.title('Phase-Only Margin')
71
72
plt .grid ()
72
73
plt .xlim ([omega [0 ], omega [- 1 ]])
73
74
plt .ylim ([0 , 90 ])
75
+ plt .xlabel ('Frequency (rad/s)' )
74
76
75
77
print (f"------------- Complementary sensitivity function (T) -------------" )
76
78
DM , GM , PM = control .disk_margins (L , omega , skew = - 1.0 , returnall = True ) # T-based (T)
@@ -83,8 +85,9 @@ def test_siso1():
83
85
plt .figure (1 )
84
86
plt .subplot (3 ,3 ,2 )
85
87
plt .semilogx (omega , DM , label = '$\\ alpha$' )
88
+ plt .ylabel ('Disk Margin (abs)' )
86
89
plt .legend ()
87
- plt .title ('Disk Margin ' )
90
+ plt .title ('T_Based Margins ' )
88
91
plt .grid ()
89
92
plt .xlim ([omega [0 ], omega [- 1 ]])
90
93
plt .ylim ([0 , 2 ])
@@ -94,7 +97,7 @@ def test_siso1():
94
97
plt .semilogx (omega , GM , label = '$\\ gamma_{m}$' )
95
98
plt .ylabel ('Gain Margin (dB)' )
96
99
plt .legend ()
97
- plt .title ('Gain-Only Margin' )
100
+ # plt.title('Gain-Only Margin')
98
101
plt .grid ()
99
102
plt .xlim ([omega [0 ], omega [- 1 ]])
100
103
plt .ylim ([0 , 40 ])
@@ -104,10 +107,11 @@ def test_siso1():
104
107
plt .semilogx (omega , PM , label = '$\\ phi_{m}$' )
105
108
plt .ylabel ('Phase Margin (deg)' )
106
109
plt .legend ()
107
- plt .title ('Phase-Only Margin' )
110
+ # plt.title('Phase-Only Margin')
108
111
plt .grid ()
109
112
plt .xlim ([omega [0 ], omega [- 1 ]])
110
113
plt .ylim ([0 , 90 ])
114
+ plt .xlabel ('Frequency (rad/s)' )
111
115
112
116
print (f"------------- Balanced sensitivity function (S - T) -------------" )
113
117
DM , GM , PM = control .disk_margins (L , omega , skew = 0.0 , returnall = True ) # balanced (S - T)
@@ -120,8 +124,9 @@ def test_siso1():
120
124
plt .figure (1 )
121
125
plt .subplot (3 ,3 ,3 )
122
126
plt .semilogx (omega , DM , label = '$\\ alpha$' )
127
+ plt .ylabel ('Disk Margin (abs)' )
123
128
plt .legend ()
124
- plt .title ('Disk Margin ' )
129
+ plt .title ('Balanced Margins ' )
125
130
plt .grid ()
126
131
plt .xlim ([omega [0 ], omega [- 1 ]])
341A
td>127
132
plt .ylim ([0 , 2 ])
@@ -131,7 +136,7 @@ def test_siso1():
131
136
plt .semilogx (omega , GM , label = '$\\ gamma_{m}$' )
132
137
plt .ylabel ('Gain Margin (dB)' )
133
138
plt .legend ()
134
- plt .title ('Gain-Only Margin' )
139
+ # plt.title('Gain-Only Margin')
135
140
plt .grid ()
136
141
plt .xlim ([omega [0 ], omega [- 1 ]])
137
142
plt .ylim ([0 , 40 ])
@@ -141,10 +146,11 @@ def test_siso1():
141
146
plt .semilogx (omega , PM , label = '$\\ phi_{m}$' )
142
147
plt .ylabel ('Phase Margin (deg)' )
143
148
plt .legend ()
144
- plt .title ('Phase-Only Margin' )
149
+ # plt.title('Phase-Only Margin')
145
150
plt .grid ()
146
151
plt .xlim ([omega [0 ], omega [- 1 ]])
147
152
plt .ylim ([0 , 90 ])
153
+ plt .xlabel ('Frequency (rad/s)' )
148
154
149
155
# Disk margin plot of admissible gain/phase variations for which
150
156
DM_plot = []
@@ -188,8 +194,9 @@ def test_siso2():
188
194
plt .figure (2 )
189
195
plt .subplot (3 ,3 ,1 )
190
196
plt .semilogx (omega , DM , label = '$\\ alpha$' )
197
+ plt .ylabel ('Disk Margin (abs)' )
191
198
plt .legend ()
192
- plt .title ('Disk Margin ' )
199
+ plt .title ('S-Based Margins ' )
193
200
plt .grid ()
194
201
plt .xlim ([omega [0 ], omega [- 1 ]])
195
202
plt .ylim ([0 , 2 ])
@@ -199,7 +206,7 @@ def test_siso2():
199
206
plt .semilogx (omega , GM , label = '$\\ gamma_{m}$' )
200
207
plt .ylabel ('Gain Margin (dB)' )
201
208
plt .legend ()
202
- plt .title ('Gain-Only Margin' )
209
+ # plt.title('Gain-Only Margin')
203
210
plt .grid ()
204
211
plt .xlim ([omega [0 ], omega [- 1 ]])
205
212
plt .ylim ([0 , 40 ])
@@ -209,10 +216,11 @@ def test_siso2():
209
216
plt .semilogx (omega , PM , label = '$\\ phi_{m}$' )
210
217
plt .ylabel ('Phase Margin (deg)' )
211
218
plt .legend ()
212
- plt .title ('Phase-Only Margin' )
219
+ # plt.title('Phase-Only Margin')
213
220
plt .grid ()
214
221
plt .xlim ([omega [0 ], omega [- 1 ]])
215
222
plt .ylim ([0 , 90 ])
223
+ plt .xlabel ('Frequency (rad/s)' )
216
224
217
225
print (f"------------- Complementary sensitivity function (T) -------------" )
218
226
DM , GM , PM = control .disk_margins (L , omega , skew = - 1.0 , returnall = True ) # T-based (T)
@@ -225,8 +233,9 @@ def test_siso2():
225
233
plt .figure (2 )
226
234
plt .subplot (3 ,3 ,2 )
227
235
plt .semilogx (omega , DM , label = '$\\ alpha$' )
236
+ plt .ylabel ('Disk Margin (abs)' )
228
237
plt .legend ()
229
- plt .title ('Disk Margin ' )
238
+ plt .title ('T-Based Margins ' )
230
239
plt .grid ()
231
240
plt .xlim ([omega [0 ], omega [- 1 ]])
232
241
plt .ylim ([0 , 2 ])
@@ -236,7 +245,7 @@ def test_siso2():
236
245
plt .semilogx (omega , GM , label = '$\\ gamma_{m}$' )
237
246
plt .ylabel ('Gain Margin (dB)' )
238
247
plt .legend ()
239
- plt .title ('Gain-Only Margin' )
248
+ # plt.title('Gain-Only Margin')
240
249
plt .grid ()
241
250
plt .xlim ([omega [0 ], omega [- 1 ]])
242
251
plt .ylim ([0 , 40 ])
@@ -246,10 +255,11 @@ def test_siso2():
246
255
plt .semilogx (omega , PM , label = '$\\ phi_{m}$' )
247
256
plt .ylabel ('Phase Margin (deg)' )
248
257
plt .legend ()
249
- plt .title ('Phase-Only Margin' )
258
+ # plt.title('Phase-Only Margin')
250
259
plt .grid ()
251
260
plt .xlim ([omega [0 ], omega [- 1 ]])
252
261
plt .ylim ([0 , 90 ])
262
+ plt .xlabel ('Frequency (rad/s)' )
253
263
254
264
print (f"------------- Balanced sensitivity function (S - T) -------------" )
255
265
DM , GM , PM = control .disk_margins (L , omega , skew = 0.0 , returnall = True ) # balanced (S - T)
@@ -262,8 +272,9 @@ def test_siso2():
262
272
plt .figure (2 )
263
273
plt .subplot (3 ,3 ,3 )
264
274
plt .semilogx (omega , DM , label = '$\\ alpha$' )
275
+ plt .ylabel ('Disk Margin (abs)' )
265
276
plt .legend ()
266
- plt .title ('Disk Margin ' )
277
+ plt .title ('Balanced Margins ' )
267
278
plt .grid ()
268
279
plt .xlim ([omega [0 ], omega [- 1 ]])
269
280
plt .ylim ([0 , 2 ])
@@ -273,7 +284,7 @@ def test_siso2():
273
284
plt .semilogx (omega , GM , label = '$\\ gamma_{m}$' )
274
285
plt .ylabel ('Gain Margin (dB)' )
275
286
plt .legend ()
276
- plt .title ('Gain-Only Margin' )
287
+ # plt.title('Gain-Only Margin')
277
288
plt .grid ()
278
289
plt .xlim ([omega [0 ], omega [- 1 ]])
279
290
plt .ylim ([0 , 40 ])
@@ -283,10 +294,11 @@ def test_siso2():
283
294
plt .semilogx (omega , PM , label = '$\\ phi_{m}$' )
284
295
plt .ylabel ('Phase Margin (deg)' )
285
296
plt .legend ()
286
- plt .title ('Phase-Only Margin' )
297
+ # plt.title('Phase-Only Margin')
287
298
plt .grid ()
288
299
plt .xlim ([omega [0 ], omega [- 1 ]])
289
300
plt .ylim ([0 , 90 ])
301
+ plt .xlabel ('Frequency (rad/s)' )
290
302
291
303
# Disk margin plot of admissible gain/phase variations for which
292
304
# the feedback loop still remains stable, for each skew parameter
@@ -327,8 +339,9 @@ def test_mimo():
327
339
plt .figure (3 )
328
340
plt .subplot (3 ,3 ,1 )
329
341
plt .semilogx (omega , DM , label = '$\\ alpha$' )
342
+ plt .ylabel ('Disk Margin (abs)' )
330
343
plt .legend ()
331
- plt .title ('Disk Margin ' )
344
+ plt .title ('S-Based Margins ' )
332
345
plt .grid ()
333
346
plt .xlim ([omega [0 ], omega [- 1 ]])
334
347
plt .ylim ([0 , 2 ])
@@ -338,7 +351,7 @@ def test_mimo():
338
351
plt .semilogx (omega , GM , label = '$\\ gamma_{m}$' )
339
352
plt .ylabel ('Gain Margin (dB)' )
340
353
plt .legend ()
341
- plt .title ('Gain-Only Margin' )
354
+ # plt.title('Gain-Only Margin')
342
355
plt .grid ()
343
356
plt .xlim ([omega [0 ], omega [- 1 ]])
344
357
plt .ylim ([0 , 40 ])
@@ -348,10 +361,11 @@ def test_mimo():
348
361
plt .semilogx (omega , PM , label = '$\\ phi_{m}$' )
349
362
plt .ylabel ('Phase Margin (deg)' )
350
363
plt .legend ()
351
- plt .title ('Phase-Only Margin' )
364
+ # plt.title('Phase-Only Margin')
352
365
plt .grid ()
353
366
plt .xlim ([omega [0 ], omega [- 1 ]])
354
367
plt .ylim ([0 , 90 ])
368
+ plt .xlabel ('Frequency (rad/s)' )
355
369
356
370
print (f"------------- Complementary sensitivity function (T) -------------" )
357
371
DM , GM , PM = control .disk_margins (L , omega , skew = - 1.0 , returnall = True ) # T-based (T)
@@ -364,8 +378,9 @@ def test_mimo():
364
378
plt .figure (3 )
365
379
plt .subplot (3 ,3 ,2 )
366
380
plt .semilogx (omega , DM , label = '$\\ alpha$' )
381
+ plt .ylabel ('Disk Margin (abs)' )
367
382
plt .legend ()
368
- plt .title ('Disk Margin ' )
383
+ plt .title ('T-Based Margins ' )
369
384
plt .grid ()
370
385
plt .xlim ([omega [0 ], omega [- 1 ]])
371
386
plt .ylim ([0 , 2 ])
@@ -375,7 +390,7 @@ def test_mimo():
375
390
plt .semilogx (omega , GM , label = '$\\ gamma_{m}$' )
376
391
plt .ylabel ('Gain Margin (dB)' )
377
392
plt .legend ()
378
- plt .title ('Gain-Only Margin' )
393
+ # plt.title('Gain-Only Margin')
379
394
plt .grid ()
380
395
plt .xlim ([omega [0 ], omega [- 1 ]])
381
396
plt .ylim ([0 , 40 ])
@@ -385,10 +400,11 @@ def test_mimo():
385
400
plt .semilogx (omega , PM , label = '$\\ phi_{m}$' )
386
401
plt .ylabel ('Phase Margin (deg)' )
387
402
plt .legend ()
388
- plt .title ('Phase-Only Margin' )
403
+ # plt.title('Phase-Only Margin')
389
404
plt .grid ()
390
405
plt .xlim ([omega [0 ], omega [- 1 ]])
391
406
plt .ylim ([0 , 90 ])
407
+ plt .xlabel ('Frequency (rad/s)' )
392
408
393
409
print (f"------------- Balanced sensitivity function (S - T) -------------" )
394
410
DM , GM , PM = control .disk_margins (L , omega , skew = 0.0 , returnall = True ) # balanced (S - T)
@@ -401,8 +417,9 @@ def test_mimo():
401
417
plt .figure (3 )
402
418
plt .subplot (3 ,3 ,3 )
403
419
plt .semilogx (omega , DM , label = '$\\ alpha$' )
420
+ plt .ylabel ('Disk Margin (abs)' )
404
421
plt .legend ()
405
- plt .title ('Disk Margin ' )
422
+ plt .title ('Balanced Margins ' )
406
423
plt .grid ()
407
424
plt .xlim ([omega [0 ], omega [- 1 ]])
408
425
plt .ylim ([0 , 2 ])
@@ -412,7 +429,7 @@ def test_mimo():
412
429
plt .semilogx (omega , GM , label = '$\\ gamma_{m}$' )
413
430
plt .ylabel ('Gain Margin (dB)' )
414
431
plt .legend ()
415
- plt .title ('Gain-Only Margin' )
432
+ # plt.title('Gain-Only Margin')
416
433
plt .grid ()
417
434
plt .xlim ([omega [0 ], omega [- 1 ]])
418
435
plt .ylim ([0 , 40 ])
@@ -422,10 +439,11 @@ def test_mimo():
422
439
plt .semilogx (omega , PM , label = '$\\ phi_{m}$' )
423
440
plt .ylabel ('Phase Margin (deg)' )
424
441
plt .legend ()
425
- plt .title ('Phase-Only Margin' )
442
+ # plt.title('Phase-Only Margin')
426
443
plt .grid ()
427
444
plt .xlim ([omega [0 ], omega [- 1 ]])
428
445
plt .ylim ([0 , 90 ])
446
+ plt .xlabel ('Frequency (rad/s)' )
429
447
430
448
# Disk margin plot of admissible gain/phase variations for which
431
449
# the feedback loop still remains stable, for each skew parameter
@@ -439,13 +457,13 @@ def test_mimo():
439
457
return
440
458
441
459
if __name__ == '__main__' :
442
- test_siso1 ()
443
- test_siso2 ()
460
+ # test_siso1()
461
+ # test_siso2()
444
462
test_mimo ()
445
463
464
+ #plt.tight_layout()
446
465
plt .show ()
447
- plt .tight_layout ()
448
-
466
+
449
467
450
468
451
469
0 commit comments