@@ -46,8 +46,9 @@ def test_siso1():
4646 plt .figure (1 )
4747 plt .subplot (3 ,3 ,1 )
4848 plt .semilogx (omega , DM , label = '$\\ alpha$' )
49+ plt .ylabel ('Disk Margin (abs)' )
4950 plt .legend ()
50- plt .title ('Disk Margin ' )
51+ plt .title ('S-Based Margins ' )
5152 plt .grid ()
5253 plt .xlim ([omega [0 ], omega [- 1 ]])
5354 plt .ylim ([0 , 2 ])
@@ -57,7 +58,7 @@ def test_siso1():
5758 plt .semilogx (omega , GM , label = '$\\ gamma_{m}$' )
5859 plt .ylabel ('Gain Margin (dB)' )
5960 plt .legend ()
60- plt .title ('Gain-Only Margin' )
61+ # plt.title('Gain-Only Margin')
6162 plt .grid ()
6263 plt .xlim ([omega [0 ], omega [- 1 ]])
6364 plt .ylim ([0 , 40 ])
@@ -67,10 +68,11 @@ def test_siso1():
6768 plt .semilogx (omega , PM , label = '$\\ phi_{m}$' )
6869 plt .ylabel ('Phase Margin (deg)' )
6970 plt .legend ()
70- plt .title ('Phase-Only Margin' )
71+ # plt.title('Phase-Only Margin')
7172 plt .grid ()
7273 plt .xlim ([omega [0 ], omega [- 1 ]])
7374 plt .ylim ([0 , 90 ])
75+ plt .xlabel ('Frequency (rad/s)' )
7476
7577 print (f"------------- Complementary sensitivity function (T) -------------" )
7678 DM , GM , PM = control .disk_margins (L , omega , skew = - 1.0 , returnall = True ) # T-based (T)
@@ -83,8 +85,9 @@ def test_siso1():
8385 plt .figure (1 )
8486 plt .subplot (3 ,3 ,2 )
8587 plt .semilogx (omega , DM , label = '$\\ alpha$' )
88+ plt .ylabel ('Disk Margin (abs)' )
8689 plt .legend ()
87- plt .title ('Disk Margin ' )
90+ plt .title ('T_Based Margins ' )
8891 plt .grid ()
8992 plt .xlim ([omega [0 ], omega [- 1 ]])
9093 plt .ylim ([0 , 2 ])
@@ -94,7 +97,7 @@ def test_siso1():
9497 plt .semilogx (omega , GM , label = '$\\ gamma_{m}$' )
9598 plt .ylabel ('Gain Margin (dB)' )
9699 plt .legend ()
97- plt .title ('Gain-Only Margin' )
100+ # plt.title('Gain-Only Margin')
98101 plt .grid ()
99102 plt .xlim ([omega [0 ], omega [- 1 ]])
100103 plt .ylim ([0 , 40 ])
@@ -104,10 +107,11 @@ def test_siso1():
104107 plt .semilogx (omega , PM , label = '$\\ phi_{m}$' )
105108 plt .ylabel ('Phase Margin (deg)' )
106109 plt .legend ()
107- plt .title ('Phase-Only Margin' )
110+ # plt.title('Phase-Only Margin')
108111 plt .grid ()
109112 plt .xlim ([omega [0 ], omega [- 1 ]])
110113 plt .ylim ([0 , 90 ])
114+ plt .xlabel ('Frequency (rad/s)' )
111115
112116 print (f"------------- Balanced sensitivity function (S - T) -------------" )
113117 DM , GM , PM = control .disk_margins (L , omega , skew = 0.0 , returnall = True ) # balanced (S - T)
@@ -120,8 +124,9 @@ def test_siso1():
120124 plt .figure (1 )
121125 plt .subplot (3 ,3 ,3 )
122126 plt .semilogx (omega , DM , label = '$\\ alpha$' )
127+ plt .ylabel ('Disk Margin (abs)' )
123128 plt .legend ()
124- plt .title ('Disk Margin ' )
129+ plt .title ('Balanced Margins ' )
125130 plt .grid ()
126131 plt .xlim ([omega [0 ], omega [- 1 ]])
127132 plt .ylim ([0 , 2 ])
@@ -131,7 +136,7 @@ def test_siso1():
131136 plt .semilogx (omega , GM , label = '$\\ gamma_{m}$' )
132137 plt .ylabel ('Gain Margin (dB)' )
133138 plt .legend ()
134- plt .title ('Gain-Only Margin' )
139+ # plt.title('Gain-Only Margin')
135140 plt .grid ()
136141 plt .xlim ([omega [0 ], omega [- 1 ]])
137142 plt .ylim ([0 , 40 ])
@@ -141,10 +146,11 @@ def test_siso1():
141146 plt .semilogx (omega , PM , label = '$\\ phi_{m}$' )
142147 plt .ylabel ('Phase Margin (deg)' )
143148 plt .legend ()
144- plt .title ('Phase-Only Margin' )
149+ # plt.title('Phase-Only Margin')
145150 plt .grid ()
146151 plt .xlim ([omega [0 ], omega [- 1 ]])
147152 plt .ylim ([0 , 90 ])
153+ plt .xlabel ('Frequency (rad/s)' )
148154
149155 # Disk margin plot of admissible gain/phase variations for which
150156 DM_plot = []
@@ -188,8 +194,9 @@ def test_siso2():
188194 plt .figure (2 )
189195 plt .subplot (3 ,3 ,1 )
190196 plt .semilogx (omega , DM , label = '$\\ alpha$' )
197+ plt .ylabel ('Disk Margin (abs)' )
191198 plt .legend ()
192- plt .title ('Disk Margin ' )
199+ plt .title ('S-Based Margins ' )
193200 plt .grid ()
194201 plt .xlim ([omega [0 ], omega [- 1 ]])
195202 plt .ylim ([0 , 2 ])
@@ -199,7 +206,7 @@ def test_siso2():
199206 plt .semilogx (omega , GM , label = '$\\ gamma_{m}$' )
200207 plt .ylabel ('Gain Margin (dB)' )
201208 plt .legend ()
202- plt .title ('Gain-Only Margin' )
209+ # plt.title('Gain-Only Margin')
203210 plt .grid ()
204211 plt .xlim ([omega [0 ], omega [- 1 ]])
205212 plt .ylim ([0 , 40 ])
@@ -209,10 +216,11 @@ def test_siso2():
209216 plt .semilogx (omega , PM , label = '$\\ phi_{m}$' )
210217 plt .ylabel ('Phase Margin (deg)' )
211218 plt .legend ()
212- plt .title ('Phase-Only Margin' )
219+ # plt.title('Phase-Only Margin')
213220 plt .grid ()
214221 plt .xlim ([omega [0 ], omega [- 1 ]])
215222 plt .ylim ([0 , 90 ])
223+ plt .xlabel ('Frequency (rad/s)' )
216224
217225 print (f"------------- Complementary sensitivity function (T) -------------" )
218226 DM , GM , PM = control .disk_margins (L , omega , skew = - 1.0 , returnall = True ) # T-based (T)
@@ -225,8 +233,9 @@ def test_siso2():
225233 plt .figure (2 )
226234 plt .subplot (3 ,3 ,2 )
227235 plt .semilogx (omega , DM , label = '$\\ alpha$' )
236+ plt .ylabel ('Disk Margin (abs)' )
228237 plt .legend ()
229- plt .title ('Disk Margin ' )
238+ plt .title ('T-Based Margins ' )
230239 plt .grid ()
231240 plt .xlim ([omega [0 ], omega [- 1 ]])
232241 plt .ylim ([0 , 2 ])
@@ -236,7 +245,7 @@ def test_siso2():
236245 plt .semilogx (omega , GM , label = '$\\ gamma_{m}$' )
237246 plt .ylabel ('Gain Margin (dB)' )
238247 plt .legend ()
239- plt .title ('Gain-Only Margin' )
248+ # plt.title('Gain-Only Margin')
240249 plt .grid ()
241250 plt .xlim ([omega [0 ], omega [- 1 ]])
242251 plt .ylim ([0 , 40 ])
@@ -246,10 +255,11 @@ def test_siso2():
246255 plt .semilogx (omega , PM , label = '$\\ phi_{m}$' )
247256 plt .ylabel ('Phase Margin (deg)' )
248257 plt .legend ()
249- plt .title ('Phase-Only Margin' )
258+ # plt.title('Phase-Only Margin')
250259 plt .grid ()
251260 plt .xlim ([omega [0 ], omega [- 1 ]])
252261 plt .ylim ([0 , 90 ])
262+ plt .xlabel ('Frequency (rad/s)' )
253263
254264 print (f"------------- Balanced sensitivity function (S - T) -------------" )
255265 DM , GM , PM = control .disk_margins (L , omega , skew = 0.0 , returnall = True ) # balanced (S - T)
@@ -262,8 +272,9 @@ def test_siso2():
262272 plt .figure (2 )
263273 plt .subplot (3 ,3 ,3 )
264274 plt .semilogx (omega , DM , label = '$\\ alpha$' )
275+ plt .ylabel ('Disk Margin (abs)' )
265276 plt .legend ()
266- plt .title ('Disk Margin ' )
277+ plt .title ('Balanced Margins ' )
267278 plt .grid ()
268279 plt .xlim ([omega [0 ], omega [- 1 ]])
269280 plt .ylim ([0 , 2 ])
@@ -273,7 +284,7 @@ def test_siso2():
273284 plt .semilogx (omega , GM , label = '$\\ gamma_{m}$' )
274285 plt .ylabel ('Gain Margin (dB)' )
275286 plt .legend ()
276- plt .title ('Gain-Only Margin' )
287+ # plt.title('Gain-Only Margin')
277288 plt .grid ()
278289 plt .xlim ([omega [0 ], omega [- 1 ]])
279290 plt .ylim ([0 , 40 ])
@@ -283,10 +294,11 @@ def test_siso2():
283294 plt .semilogx (omega , PM , label = '$\\ phi_{m}$' )
284295 plt .ylabel ('Phase Margin (deg)' )
285296 plt .legend ()
286- plt .title ('Phase-Only Margin' )
297+ # plt.title('Phase-Only Margin')
287298 plt .grid ()
288299 plt .xlim ([omega [0 ], omega [- 1 ]])
289300 plt .ylim ([0 , 90 ])
301+ plt .xlabel ('Frequency (rad/s)' )
290302
291303 # Disk margin plot of admissible gain/phase variations for which
292304 # the feedback loop still remains stable, for each skew parameter
@@ -327,8 +339,9 @@ def test_mimo():
327339 plt .figure (3 )
328340 plt .subplot (3 ,3 ,1 )
329341 plt .semilogx (omega , DM , label = '$\\ alpha$' )
342+ plt .ylabel ('Disk Margin (abs)' )
330343 plt .legend ()
331- plt .title ('Disk Margin ' )
344+ plt .title ('S-Based Margins ' )
332345 plt .grid ()
333346 plt .xlim ([omega [0 ], omega [- 1 ]])
334347 plt .ylim ([0 , 2 ])
@@ -338,7 +351,7 @@ def test_mimo():
338351 plt .semilogx (omega , GM , label = '$\\ gamma_{m}$' )
339352 plt .ylabel ('Gain Margin (dB)' )
340353 plt .legend ()
341- plt .title ('Gain-Only Margin' )
354+ # plt.title('Gain-Only Margin')
342355 plt .grid ()
343356 plt .xlim ([omega [0 ], omega [- 1 ]])
344357 plt .ylim ([0 , 40 ])
@@ -348,10 +361,11 @@ def test_mimo():
348361 plt .semilogx (omega , PM , label = '$\\ phi_{m}$' )
349362 plt .ylabel ('Phase Margin (deg)' )
350363 plt .legend ()
351- plt .title ('Phase-Only Margin' )
364+ # plt.title('Phase-Only Margin')
352365 plt .grid ()
353366 plt .xlim ([omega [0 ], omega [- 1 ]])
354367 plt .ylim ([0 , 90 ])
368+ plt .xlabel ('Frequency (rad/s)' )
355369
356370 print (f"------------- Complementary sensitivity function (T) -------------" )
357371 DM , GM , PM = control .disk_margins (L , omega , skew = - 1.0 , returnall = True ) # T-based (T)
@@ -364,8 +378,9 @@ def test_mimo():
364378 plt .figure (3 )
365379 plt .subplot (3 ,3 ,2 )
366380 plt .semilogx (omega , DM , label = '$\\ alpha$' )
381+ plt .ylabel ('Disk Margin (abs)' )
367382 plt .legend ()
368- plt .title ('Disk Margin ' )
383+ plt .title ('T-Based Margins ' )
369384 plt .grid ()
370385 plt .xlim ([omega [0 ], omega [- 1 ]])
371386 plt .ylim ([0 , 2 ])
@@ -375,7 +390,7 @@ def test_mimo():
375390 plt .semilogx (omega , GM , label = '$\\ gamma_{m}$' )
376391 plt .ylabel ('Gain Margin (dB)' )
377392 plt .legend ()
378- plt .title ('Gain-Only Margin' )
393+ # plt.title('Gain-Only Margin')
379394 plt .grid ()
380395 plt .xlim ([omega [0 ], omega [- 1 ]])
381396 plt .ylim ([0 , 40 ])
@@ -385,10 +400,11 @@ def test_mimo():
385400 plt .semilogx (omega , PM , label = '$\\ phi_{m}$' )
386401 plt .ylabel ('Phase Margin (deg)' )
387402 plt .legend ()
388- plt .title ('Phase-Only Margin' )
403+ # plt.title('Phase-Only Margin')
389404 plt .grid ()
390405 plt .xlim ([omega [0 ], omega [- 1 ]])
391406 plt .ylim ([0 , 90 ])
407+ plt .xlabel ('Frequency (rad/s)' )
392408
393409 print (f"------------- Balanced sensitivity function (S - T) -------------" )
394410 DM , GM , PM = control .disk_margins (L , omega , skew = 0.0 , returnall = True ) # balanced (S - T)
@@ -401,8 +417,9 @@ def test_mimo():
401417 plt .figure (3 )
402418 plt .subplot (3 ,3 ,3 )
403419 plt .semilogx (omega , DM , label = '$\\ alpha$' )
420+ plt .ylabel ('Disk Margin (abs)' )
404421 plt .legend ()
405- plt .title ('Disk Margin ' )
422+ plt .title ('Balanced Margins ' )
406423 plt .grid ()
407424 plt .xlim ([omega [0 ], omega [- 1 ]])
408425 plt .ylim ([0 , 2 ])
@@ -412,7 +429,7 @@ def test_mimo():
412429 plt .semilogx (omega , GM , label = '$\\ gamma_{m}$' )
413430 plt .ylabel ('Gain Margin (dB)' )
414431 plt .legend ()
415- plt .title ('Gain-Only Margin' )
432+ # plt.title('Gain-Only Margin')
416433 plt .grid ()
417434 plt .xlim ([omega [0 ], omega [- 1 ]])
418435 plt .ylim ([0 , 40 ])
@@ -422,10 +439,11 @@ def test_mimo():
422439 plt .semilogx (omega , PM , label = '$\\ phi_{m}$' )
423440 plt .ylabel ('Phase Margin (deg)' )
424441 plt .legend ()
425- plt .title ('Phase-Only Margin' )
442+ # plt.title('Phase-Only Margin')
426443 plt .grid ()
427444 plt .xlim ([omega [0 ], omega [- 1 ]])
428445 plt .ylim ([0 , 90 ])
446+ plt .xlabel ('Frequency (rad/s)' )
429447
430448 # Disk margin plot of admissible gain/phase variations for which
431449 # the feedback loop still remains stable, for each skew parameter
@@ -439,13 +457,13 @@ def test_mimo():
439457 return
440458
441459if __name__ == '__main__' :
442- test_siso1 ()
443- test_siso2 ()
460+ # test_siso1()
461+ # test_siso2()
444462 test_mimo ()
445463
464+ #plt.tight_layout()
446465 plt .show ()
447- plt .tight_layout ()
448-
466+
449467
450468
451469
0 commit comments