@@ -83,7 +83,9 @@ def bode_plot(syslist, omega=None,
83
83
Plot = True , omega_limits = None , omega_num = None ,
84
84
margins = None , * args , ** kwargs ):
85
85
"""Bode plot for a system
86
+
86
87
Plots a Bode plot for the system over a (optional) frequency range.
88
+
87
89
Parameters
88
90
----------
89
91
syslist : linsys
@@ -112,6 +114,7 @@ def bode_plot(syslist, omega=None,
112
114
Additional arguments for :func:`matplotlib.plot` (color, linestyle, etc)
113
115
**kwargs:
114
116
Additional keywords (passed to `matplotlib`)
117
+
115
118
Returns
116
119
-------
117
120
mag : array (list if len(syslist) > 1)
@@ -120,13 +123,15 @@ def bode_plot(syslist, omega=None,
120
123
phase in radians
121
124
omega : array (list if len(syslist) > 1)
122
125
frequency in rad/sec
126
+
123
127
Other Parameters
124
128
----------------
125
129
grid : bool
126
130
If True, plot grid lines on gain and phase plots. Default is set by
127
131
config.defaults['bode.grid'].
128
132
The default values for Bode plot configuration parameters can be reset
129
133
using the `config.defaults` dictionary, with module name 'bode'.
134
+
130
135
Notes
131
136
-----
132
137
1. Alternatively, you may use the lower-level method (mag, phase, freq)
@@ -136,10 +141,12 @@ def bode_plot(syslist, omega=None,
136
141
along the upper branch of the unit circle, using the mapping z = exp(j
137
142
\\ omega dt) where omega ranges from 0 to pi/dt and dt is the discrete
138
143
timebase. If not timebase is specified (dt = True), dt is set to 1.
144
+
139
145
Examples
140
146
--------
141
147
>>> sys = ss("1. -2; 3. -4", "5.; 7", "6. 8", "9.")
142
148
>>> mag, phase, omega = bode(sys)
149
+
143
150
"""
144
151
# Make a copy of the kwargs dictonary since we will modify it
145
152
kwargs = dict (kwargs )
@@ -428,7 +435,9 @@ def nyquist_plot(syslist, omega=None, Plot=True,
428
435
labelFreq = 0 , hl = 0.1 , hw = 0.1 , color = None , * args , ** kwargs ):
429
436
"""
430
437
Nyquist plot for a system
438
+
431
439
Plots a Nyquist plot for the system over a (optional) frequency range.
440
+
432
441
Parameters
433
442
----------
434
443
syslist : list of LTI
@@ -441,12 +450,11 @@ def nyquist_plot(syslist, omega=None, Plot=True,
441
450
Used to specify the color of the plot
442
451
labelFreq : int
443
452
Label every nth frequency on the plot
444
- hl : float (default 0.1), Head length of arrow
445
- hw : float (default 0.1), Head width of arrow
446
453
*args
447
454
Additional arguments for :func:`matplotlib.plot` (color, linestyle, etc)
448
455
**kwargs:
449
456
Additional keywords (passed to `matplotlib`)
457
+
450
458
Returns
451
459
-------
452
460
real : array
@@ -455,10 +463,12 @@ def nyquist_plot(syslist, omega=None, Plot=True,
455
463
imaginary part of the frequency response array
456
464
freq : array
457
465
frequencies
466
+
458
467
Examples
459
468
--------
460
469
>>> sys = ss("1. -2; 3. -4", "5.; 7", "6. 8", "9.")
461
470
>>> real, imag, freq = nyquist_plot(sys)
471
+
462
472
"""
463
473
# If argument was a singleton, turn it into a list
464
474
if not getattr (syslist , '__iter__' , False ):
@@ -549,14 +559,17 @@ def nyquist_plot(syslist, omega=None, Plot=True,
549
559
# TODO: think about how (and whether) to handle lists of systems
550
560
def gangof4_plot (P , C , omega = None , ** kwargs ):
551
561
"""Plot the "Gang of 4" transfer functions for a system
562
+
552
563
Generates a 2x2 plot showing the "Gang of 4" sensitivity functions
553
564
[T, PS; CS, S]
565
+
554
566
Parameters
555
567
----------
556
568
P, C : LTI
557
569
Linear input/output systems (process and control)
558
570
omega : array
559
571
Range of frequencies (list or bounds) in rad/sec
572
+
560
573
Returns
561
574
-------
562
575
None
@@ -651,8 +664,10 @@ def default_frequency_range(syslist, Hz=None, number_of_samples=None,
651
664
feature_periphery_decades = None ):
652
665
"""Compute a reasonable default frequency range for frequency
653
666
domain plots.
667
+
654
668
Finds a reasonable default frequency range by examining the features
655
669
(poles and zeros) of the systems in syslist.
670
+
656
671
Parameters
657
672
----------
658
673
syslist : list of LTI
@@ -669,15 +684,18 @@ def default_frequency_range(syslist, Hz=None, number_of_samples=None,
669
684
Defines how many decades shall be included in the frequency range on
670
685
both sides of features (poles, zeros). The default value is read from
671
686
``config.defaults['freqplot.feature_periphery_decades']``.
687
+
672
688
Returns
673
689
-------
674
690
omega : array
675
691
Range of frequencies in rad/sec
692
+
676
693
Examples
677
694
--------
678
695
>>> from matlab import ss
679
696
>>> sys = ss("1. -2; 3. -4", "5.; 7", "6. 8", "9.")
680
697
>>> omega = default_frequency_range(sys)
698
+
681
699
"""
682
700
# This code looks at the poles and zeros of all of the systems that
683
701
# we are plotting and sets the frequency range to be one decade above
0 commit comments