Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion control/tests/convert_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def testConvert(self, fixedseed, states, inputs, outputs):
def testConvertMIMO(self):
"""Test state space to transfer function conversion.

Do a MIMO conversation and make sure that it is processed
Do a MIMO conversion and make sure that it is processed
correctly both with and without slycot

Example from issue gh-120, jgoppert
Expand Down
4 changes: 2 additions & 2 deletions control/timeresp.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def forced_response(sys, T=None, U=0., X0=0., transpose=False,
if isinstance(sys, TransferFunction) and np.any(X0 != 0):
warnings.warn(
"Non-zero initial condition given for transfer function system. "
"Internal conversation to state space used; may not be consistent "
"Internal conversion to state space used; may not be consistent "
"with given X0.")

xout = np.zeros((n_states, n_steps))
Expand Down Expand Up @@ -702,7 +702,7 @@ def step_response(sys, T=None, X0=0., input=None, output=None, T_num=None,
if isinstance(sys, TransferFunction) and np.any(X0 != 0):
warnings.warn(
"Non-zero initial condition given for transfer function system. "
"Internal conversation to state space used; may not be consistent "
"Internal conversion to state space used; may not be consistent "
"with given X0.")

# Convert to state space so that we can simulate
Expand Down
11 changes: 4 additions & 7 deletions examples/robust_mimo.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,8 @@ def analysis():
g = plant()

t = np.linspace(0, 10, 101)
_, yu1 = step_response(g, t, input=0)
_, yu2 = step_response(g, t, input=1)

yu1 = yu1
yu2 = yu2
_, yu1 = step_response(g, t, input=0, squeeze=True)
_, yu2 = step_response(g, t, input=1, squeeze=True)

# linear system, so scale and sum previous results to get the
# [1,-1] response
Expand Down Expand Up @@ -112,8 +109,8 @@ def synth(wb1, wb2):

def step_opposite(g, t):
"""reponse to step of [-1,1]"""
_, yu1 = step_response(g, t, input=0)
_, yu2 = step_response(g, t, input=1)
_, yu1 = step_response(g, t, input=0, squeeze=True)
_, yu2 = step_response(g, t, input=1, squeeze=True)
return yu1 - yu2


Expand Down
2 changes: 1 addition & 1 deletion examples/secord-matlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

# Bode plot for the system
plt.figure(2)
mag, phase, om = bode(sys, logspace(-2, 2), Plot=True)
mag, phase, om = bode(sys, logspace(-2, 2), plot=True)
plt.show(block=False)

# Nyquist plot for the system
Expand Down
18 changes: 14 additions & 4 deletions examples/test-response.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import os
import matplotlib.pyplot as plt # MATLAB plotting functions
from control.matlab import * # Load the controls systems library
from scipy import arange # function to create range of numbers
from numpy import arange # function to create range of numbers

from control import reachable_form

# Create several systems for testing
sys1 = tf([1], [1, 2, 1])
Expand All @@ -13,10 +15,18 @@
# Generate step responses
(y1a, T1a) = step(sys1)
(y1b, T1b) = step(sys1, T=arange(0, 10, 0.1))
(y1c, T1c) = step(sys1, X0=[1, 0])
# convert to reachable canonical SS to specify initial state
sys1_ss = reachable_form(ss(sys1))[0]
(y1c, T1c) = step(sys1_ss, X0=[1, 0])
(y2a, T2a) = step(sys2, T=arange(0, 10, 0.1))

plt.plot(T1a, y1a, T1b, y1b, T1c, y1c, T2a, y2a)
plt.plot(T1a, y1a, label='$g_1$ (default)', linewidth=5)
plt.plot(T1b, y1b, label='$g_1$ (w/ spec. times)', linestyle='--')
plt.plot(T1c, y1c, label='$g_1$ (w/ init cond.)')
plt.plot(T2a, y2a, label='$g_2$ (w/ spec. times)')
plt.xlabel('time')
plt.ylabel('output')
plt.legend()

if 'PYCONTROL_TEST_EXAMPLES' not in os.environ:
plt.show()
plt.show()