Skip to content

Commit 32668d3

Browse files
committed
Merge branch 'master' into improve-docs
Conflicts: control/mateqn.py
2 parents add59c3 + 770c4d7 commit 32668d3

File tree

2 files changed

+22
-17
lines changed

2 files changed

+22
-17
lines changed

control/freqplot.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,27 +126,30 @@ def bode_plot(syslist, omega=None, dB=None, Hz=None, deg=None,
126126
omega = default_frequency_range(syslist)
127127

128128
# Get the magnitude and phase of the system
129-
mag_tmp, phase_tmp, omega = sys.freqresp(omega)
129+
mag_tmp, phase_tmp, omega_sys = sys.freqresp(omega)
130130
mag = np.atleast_1d(np.squeeze(mag_tmp))
131131
phase = np.atleast_1d(np.squeeze(phase_tmp))
132132
phase = unwrap(phase)
133-
if Hz: omega = omega/(2*sp.pi)
133+
if Hz:
134+
omega_plot = omega_sys/(2*sp.pi)
135+
else:
136+
omega_plot = omega_sys
134137
if dB: mag = 20*sp.log10(mag)
135138
if deg: phase = phase * 180 / sp.pi
136139

137140
mags.append(mag)
138141
phases.append(phase)
139-
omegas.append(omega)
142+
omegas.append(omega_sys)
140143
# Get the dimensions of the current axis, which we will divide up
141144
#! TODO: Not current implemented; just use subplot for now
142145

143146
if (Plot):
144147
# Magnitude plot
145148
plt.subplot(211);
146149
if dB:
147-
plt.semilogx(omega, mag, *args, **kwargs)
150+
plt.semilogx(omega_plot, mag, *args, **kwargs)
148151
else:
149-
plt.loglog(omega, mag, *args, **kwargs)
152+
plt.loglog(omega_plot, mag, *args, **kwargs)
150153
plt.hold(True);
151154

152155
# Add a grid to the plot + labeling
@@ -156,7 +159,7 @@ def bode_plot(syslist, omega=None, dB=None, Hz=None, deg=None,
156159

157160
# Phase plot
158161
plt.subplot(212);
159-
plt.semilogx(omega, phase, *args, **kwargs)
162+
plt.semilogx(omega_plot, phase, *args, **kwargs)
160163
plt.hold(True);
161164

162165
# Add a grid to the plot + labeling

control/mateqn.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -411,25 +411,27 @@ def dlyap(A,Q,C=None,E=None):
411411
#### Riccati equation solvers care and dare
412412

413413
def care(A,B,Q,R=None,S=None,E=None):
414-
""" (X,L,G) = care(A,B,Q) solves the continuous-time algebraic Riccati
414+
""" (X,L,G) = care(A,B,Q,R=None) solves the continuous-time algebraic Riccati
415415
equation
416416
417-
:math:`A^T X + X A - X B B^T X + Q = 0`
417+
:math:`A^T X + X A - X B R^{-1} B^T X + Q = 0`
418418
419-
where A and Q are square matrices of the same dimension. Further, Q
420-
is a symmetric matrix. The function returns the solution X, the gain
421-
matrix G = B^T X and the closed loop eigenvalues L, i.e., the eigenvalues
422-
of A - B G.
419+
where A and Q are square matrices of the same dimension. Further,
420+
Q and R are a symmetric matrices. If R is None, it is set to the
421+
identity matrix. The function returns the solution X, the gain
422+
matrix G = B^T X and the closed loop eigenvalues L, i.e., the
423+
eigenvalues of A - B G.
423424
424425
(X,L,G) = care(A,B,Q,R,S,E) solves the generalized continuous-time
425426
algebraic Riccati equation
426427
427428
:math:`A^T X E + E^T X A - (E^T X B + S) R^{-1} (B^T X E + S^T) + Q = 0`
428429
429-
where A, Q and E are square matrices of the same dimension. Further, Q and
430-
R are symmetric matrices. The function returns the solution X, the gain
431-
matrix G = R^-1 (B^T X E + S^T) and the closed loop eigenvalues L, i.e.,
432-
the eigenvalues of A - B G , E. """
430+
where A, Q and E are square matrices of the same
431+
dimension. Further, Q and R are symmetric matrices. If R is None,
432+
it is set to the identity matrix. The function returns the
433+
solution X, the gain matrix G = R^-1 (B^T X E + S^T) and the
434+
closed loop eigenvalues L, i.e., the eigenvalues of A - B G , E."""
433435

434436
# Make sure we can import required slycot routine
435437
try:
@@ -531,7 +533,7 @@ def care(A,B,Q,R=None,S=None,E=None):
531533
e.info = ve.info
532534
elif ve.info == 1:
533535
e = ValueError("The matrix A is (numerically) singular in \
534-
discrete-time case.")
536+
continuous-time case.")
535537
e.info = ve.info
536538
elif ve.info == 2:
537539
e = ValueError("The Hamiltonian or symplectic matrix H cannot \

0 commit comments

Comments
 (0)