Skip to content

Commit 85328d9

Browse files
authored
Merge pull request #965 from bnavigator/fix-examples
Fix examples
2 parents a8a54d1 + 2c32913 commit 85328d9

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

examples/bode-and-nyquist-plots.ipynb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"metadata": {},
1717
"outputs": [],
1818
"source": [
19+
"import numpy as np\n",
1920
"import scipy as sp\n",
2021
"import matplotlib.pyplot as plt\n",
2122
"import control as ct"
@@ -109,9 +110,9 @@
109110
"w001rad = 1. # 1 rad/s\n",
110111
"w010rad = 10. # 10 rad/s\n",
111112
"w100rad = 100. # 100 rad/s\n",
112-
"w001hz = 2*sp.pi*1. # 1 Hz\n",
113-
"w010hz = 2*sp.pi*10. # 10 Hz\n",
114-
"w100hz = 2*sp.pi*100. # 100 Hz\n",
113+
"w001hz = 2*np.pi*1. # 1 Hz\n",
114+
"w010hz = 2*np.pi*10. # 10 Hz\n",
115+
"w100hz = 2*np.pi*100. # 100 Hz\n",
115116
"# First order systems\n",
116117
"pt1_w001rad = ct.tf([1.], [1./w001rad, 1.], name='pt1_w001rad')\n",
117118
"display(pt1_w001rad)\n",
@@ -153,7 +154,7 @@
153154
],
154155
"source": [
155156
"sampleTime = 0.001\n",
156-
"display('Nyquist frequency: {:.0f} Hz, {:.0f} rad/sec'.format(1./sampleTime /2., 2*sp.pi*1./sampleTime /2.))"
157+
"display('Nyquist frequency: {:.0f} Hz, {:.0f} rad/sec'.format(1./sampleTime /2., 2*np.pi*1./sampleTime /2.))"
157158
]
158159
},
159160
{

examples/genswitch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def genswitch(y, t, mu=4, n=2):
6060
# set(pl, 'LineWidth', AM_data_linewidth)
6161
plt.axis([0, 25, 0, 5])
6262

63-
plt.xlabel('Time {\itt} [scaled]')
63+
plt.xlabel('Time {\\itt} [scaled]')
6464
plt.ylabel('Protein concentrations [scaled]')
6565
plt.legend(('z1 (A)', 'z2 (B)')) # 'Orientation', 'horizontal')
6666
# legend(legh, 'boxoff')

examples/kincar-flatsys.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ def plot_results(t, x, ud, rescale=True):
100100

101101
plt.subplot(2, 4, 8)
102102
plt.plot(t, ud[1])
103-
plt.xlabel('Ttime t [sec]')
104-
plt.ylabel('$\delta$ [rad]')
103+
plt.xlabel('Time t [sec]')
104+
plt.ylabel('$\\delta$ [rad]')
105105
plt.tight_layout()
106106

107107
#

examples/singular-values-plot.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
],
9191
"source": [
9292
"sampleTime = 10\n",
93-
"display('Nyquist frequency: {:.4f} Hz, {:.4f} rad/sec'.format(1./sampleTime /2., 2*sp.pi*1./sampleTime /2.))"
93+
"display('Nyquist frequency: {:.4f} Hz, {:.4f} rad/sec'.format(1./sampleTime /2., 2*np.pi*1./sampleTime /2.))"
9494
]
9595
},
9696
{

examples/type2_type3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import os
66
import matplotlib.pyplot as plt # Grab MATLAB plotting functions
77
from control.matlab import * # MATLAB-like functions
8-
from scipy import pi
8+
from numpy import pi
99
integrator = tf([0, 1], [1, 0]) # 1/s
1010

1111
# Parameters defining the system

0 commit comments

Comments
 (0)