8000 Fix examples by bnavigator · Pull Request #965 · python-control/python-control · GitHub
[go: up one dir, main page]

Skip to content

Fix examples #965

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 23, 2024
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
9 changes: 5 additions & 4 deletions examples/bode-and-nyquist-plots.ipynb
8000
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import scipy as sp\n",
"import matplotlib.pyplot as plt\n",
"import control as ct"
Expand Down Expand Up @@ -109,9 +110,9 @@
"w001rad = 1. # 1 rad/s\n",
"w010rad = 10. # 10 rad/s\n",
"w100rad = 100. # 100 rad/s\n",
"w001hz = 2*sp.pi*1. # 1 Hz\n",
"w010hz = 2*sp.pi*10. # 10 Hz\n",
"w100hz = 2*sp.pi*100. # 100 Hz\n",
"w001hz = 2*np.pi*1. # 1 Hz\n",
"w010hz = 2*np.pi*10. # 10 Hz\n",
"w100hz = 2*np.pi*100. # 100 Hz\n",
"# First order systems\n",
"pt1_w001rad = ct.tf([1.], [1./w001rad, 1.], name='pt1_w001rad')\n",
"display(pt1_w001rad)\n",
Expand Down Expand Up @@ -153,7 +154,7 @@
],
"source": [
"sampleTime = 0.001\n",
"display('Nyquist frequency: {:.0f} Hz, {:.0f} rad/sec'.format(1./sampleTime /2., 2*sp.pi*1./sampleTime /2.))"
"display('Nyquist frequency: {:.0f} Hz, {:.0f} rad/sec'.format(1./sampleTime /2., 2*np.pi*1./sampleTime /2.))"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion examples/genswitch.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def genswitch(y, t, mu=4, n=2):
# set(pl, 'LineWidth', AM_data_linewidth)
plt.axis([0, 25, 0, 5])

plt.xlabel('Time {\itt} [scaled]')
plt.xlabel('Time {\\itt} [scaled]')
plt.ylabel('Protein concentrations [scaled]')
plt.legend(('z1 (A)', 'z2 (B)')) # 'Orientation', 'horizontal')
# legend(legh, 'boxoff')
Expand Down
4 changes: 2 additions & 2 deletions examples/kincar-flatsys.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ def plot_results(t, x, ud, rescale=True):

plt.subplot(2, 4, 8)
plt.plot(t, ud[1])
plt.xlabel('Ttime t [sec]')
plt.ylabel('$\delta$ [rad]')
plt.xlabel('Time t [sec]')
plt.ylabel('$\\delta$ [rad]')
plt.tight_layout()

#
Expand Down
2 changes: 1 addition & 1 deletion examples/singular-values-plot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
],
"source": [
"sampleTime = 10\n",
"display('Nyquist frequency: {:.4f} Hz, {:.4f} rad/sec'.format(1./sampleTime /2., 2*sp.pi*1./sampleTime /2.))"
"display('Nyquist frequency: {:.4f} Hz, {:.4f} rad/sec'.format(1./sampleTime /2., 2*np.pi*1./sampleTime /2.))"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion examples/type2_type3.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import os
import matplotlib.pyplot as plt # Grab MATLAB plotting functions
from control.matlab import * # MATLAB-like functions
from scipy import pi
from numpy import pi
integrator = tf([0, 1], [1, 0]) # 1/s

# Parameters defining the system
Expand Down
0