Skip to content

Commit 93b50b1

Browse files
committed
Add documentation for custom configurations
1 parent 303480f commit 93b50b1

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

control/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
from .frdata import *
6767
from .canonical import *
6868
from .robust import *
69+
from .config import *
6970

7071
# Exceptions
7172
from .exception import *

control/config.py

+9
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,22 @@
1616

1717
# Set defaults to match MATLAB
1818
def use_matlab_defaults():
19+
"""
20+
Use MATLAB compatible configuration settings
21+
* Bode plots plot gain in dB, phase in degrees, frequency in Hertz
22+
"""
1923
# Bode plot defaults
2024
global bode_dB; bode_dB = True
2125
global bode_deg; bode_deg = True
2226
global bode_Hz; bode_Hz = True
2327

2428
# Set defaults to match FBS (Astrom and Murray)
2529
def use_fbs_defaults():
30+
"""
31+
Use `Astrom and Murray <http://fbsbook.org>`_ compatible settings
32+
* Bode plots plot gain in powers of ten, phase in degrees,
33+
frequency in Hertz
34+
"""
2635
# Bode plot defaults
2736
global bode_dB; bode_dB = False
2837
global bode_deg; bode_deg = True

doc/conventions.rst

+27
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
.. _conventions-ref:
22

3+
.. currentmodule:: control
4+
35
###################
46
Library conventions
57
###################
@@ -74,3 +76,28 @@ can be computed like this::
7476

7577
ft = D * U
7678

79+
Package configuration
80+
=====================
81+
82+
The python-control library can be customized to allow for different plotting
83+
conventions. The currently configurable options allow the units for Bode
84+
plots to be set as dB for gain, degrees for phase and Hertz for frequency
85+
(MATLAB conventions) or the gain can be given in magnitude units (powers of
86+
10), corresponding to the conventions used in `Feedback Systems
87+
<http://www.cds.caltech.edu/~murray/FBSwiki>`_.
88+
89+
Variables that can be configured, along with their default values:
90+
* bode_dB (False): Bode plot magnitude plotted in dB (otherwise powers of 10)
91+
* bode_deg (True): Bode plot phase plotted in degrees (otherwise radians)
92+
* bode_Hz (False): Bode plot frequency plotted in Hertz (otherwise rad/sec)
93+
* bode_number_of_samples (None): Number of frequency points in Bode plots
94+
* bode_feature_periphery_decade (1.0): How many decades to include in the
95+
frequency range on both sides of features (poles, zeros).
96+
97+
Functions that can be used to set standard configurations:
98+
99+
.. autosummary::
100+
:toctree: generated/
101+
102+
use_fbs_defaults
103+
use_matlab_defaults

0 commit comments

Comments
 (0)