Skip to content

Commit

Permalink
Removed redundant parentheses
Browse files Browse the repository at this point in the history
  • Loading branch information
alchemyst committed Mar 29, 2015
1 parent 3b87642 commit 86b5bbd
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Chapter_05.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ def rule6(G, Gm, message=False):
else: valid6 = False

if message:
if (wz != 0):
if wz != 0:
print 'These are the roots of the transfer function matrix GGm' , zeros
if valid6:
print 'The critical frequency of S for the system to be controllable is' , wz
Expand Down
4 changes: 2 additions & 2 deletions Chapter_06.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def Min_Peaks(Zeros_G, Poles_G, error_poles_direction, io_type, usedeadtime=Fals
p_direction = np.matrix(np.zeros([G(0.001).shape[0], len(Poles_G)]))

# error_poles_direction is to to prevent the numerical method from breaking
if (io_type == 'input'):
if io_type == 'input':

for i in range(len(Zeros_G)):
[U, S, V] = np.linalg.svd(G(Zeros_G[i]+error_poles_direction))
Expand All @@ -107,7 +107,7 @@ def Min_Peaks(Zeros_G, Poles_G, error_poles_direction, io_type, usedeadtime=Fals
[U, S, V] = np.linalg.svd(G(Poles_G[i] + error_poles_direction))
p_direction[:, i] = U[:, 0]

elif (io_type == 'output'):
elif io_type == 'output':

for i in range(len(Zeros_G)):
[U, S, V] = np.linalg.svd(G(Zeros_G[i]+error_poles_direction))
Expand Down
4 changes: 2 additions & 2 deletions Exercise_06_08.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ def g11(s):


def g12(s):
return (1/(s**2 + 100))
return 1/(s**2 + 100)


def g21(s):
return (1/(s**2 + 100)) * ((s + 0.1)/(s + 1))


def g22(s):
return (1/(s**2 + 100))
return 1/(s**2 + 100)


def lambda11(s):
Expand Down
2 changes: 1 addition & 1 deletion Figure_05_08.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
#Figure 5.8
G = (-s + 1)/(s + 1)
Kc = [0.1, 0.5, 0.9]
K = -1*(s)/((1 + 0.02*s)*(1 + 0.05*s))
K = -1*s/((1 + 0.02*s)*(1 + 0.05*s))

utilsplot.freq_step_response_plot(G, K, Kc, 0.2, 1000, 'S', 'Figure 5.8')
2 changes: 1 addition & 1 deletion Figure_05_09.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
G = (1 - s)/(s + 1)

for kc in [0.1, 0.5, 0.9]:
k1 = -1*kc*(s)/((1 + 0.02*s)*(1 + 0.05*s))
k1 = -1*kc*s/((1 + 0.02*s)*(1 + 0.05*s))
L = G*k1
S = 1/(1 + L)
plt.loglog(w, abs(S))
Expand Down
6 changes: 3 additions & 3 deletions Figure_05_18.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@
plt.annotate('', (m2x, m2gd), (m2x, m2l), arrowprops=dict(arrowstyle='<->', shrinkA=0, shrinkB=0))
plt.annotate('$M_2$', (m2x + 25, abs(m2gd - m2l) / 1.5))

if (wp != 0):
if wp != 0:
plt.annotate('', (wp, 10**-2.5), (wc, 10**-2.5), arrowprops=dict(arrowstyle='<->', shrinkA=0, shrinkB=0))
plt.annotate('$M_3$', (abs(wc - wp) / 1.5, 10**-2.3))

if (wz != 0):
if wz != 0:
plt.annotate('', (wc, 10**-3.5), (wz, 10**-3.5), arrowprops=dict(arrowstyle='<->', shrinkA=0, shrinkB=0))
plt.annotate('$M_4$', (abs(wc - wz) / 3, 10**-3.3))

Expand All @@ -89,7 +89,7 @@
plt.annotate('', (0.001, 10**-2.5), (wd, 10**-2.5), arrowprops=dict(arrowstyle='<-', shrinkA=0, shrinkB=0))
plt.annotate('Control needed to reject disturbances', (0.0015, 10**-2.3))

if (wtd != 0):
if wtd != 0:
plt.annotate('', (wc, 10**-5.5), (wtd, 10**-5.5), arrowprops=dict(arrowstyle='<->', shrinkA=0, shrinkB=0))
plt.annotate('$M_6$', (abs(wc - wtd) / 8, 10**-5.3))

Expand Down
2 changes: 1 addition & 1 deletion Figure_08_16.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
s = 1j*w

Wi = (s + 0.2)/(0.5 * s + 1)
Wp = (s/2 + 0.05)/(s)
Wp = (s/2 + 0.05)/s

plt.figure(1)
plt.title('Weight Values over Frequency')
Expand Down
4 changes: 2 additions & 2 deletions MIMOnyquist.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@


def G(s):
return(K*np.exp(-t1*s)/(t2*s + 1))
return K*np.exp(-t1*s)/(t2*s + 1)


def L(s):
return(Kc*G(s))
return Kc*G(s)

mino_nyquist_plot(L, 2, -3, 3)
plt.show()
4 changes: 2 additions & 2 deletions Nyquist_PM_GM.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ def mod(w):
# plotting a unit circle
x = np.linspace(-1, 1, 200)

y_upper = np.sqrt(1-(x)**2)
y_down = -1*np.sqrt(1-(x)**2)
y_upper = np.sqrt(1- x**2)
y_down = -1*np.sqrt(1- x**2)
plt.plot(x, y_upper, 'r-', x, y_down, 'r-')

plt.show()
Expand Down
2 changes: 1 addition & 1 deletion SVD_w.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def G(w):
s = w*1j

# the matrix transfer function
G = [[1/(s+1), 1/(10*s+1)**2, 1], [0.4/((s)*(s+3)), -0.1/(s**2+1), 1], [1/(s+1), 10/(s+11), 1/(s+0.001)]]
G = [[1/(s+1), 1/(10*s+1)**2, 1], [0.4/(s*(s+3)), -0.1/(s**2+1), 1], [1/(s+1), 10/(s+11), 1/(s+0.001)]]
return G


Expand Down
2 changes: 1 addition & 1 deletion perturbed_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def Gp(s, vec, i):
def weight_i(s, a, b, c):
"""Function to give the weight of the uncertainty"""

w_i = (((s * a + start) / ((a / (end)) * s + 1))
w_i = (((s * a + start) / ((a /end) * s + 1))
* ((s ** 2 + b * s + 1) / (s ** 2 + c * s + 1)))
# w_i = ((((s * a + start) / ((a / (end)) * s + 1))
# * ((s ** 2 + b * s + 1) / (s ** 2 + c * s + 1)))
Expand Down
4 changes: 2 additions & 2 deletions robusttools.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ def UnstructuredDelta(M, DeltaStructure):
unstructured delta matrix
'''

if (DeltaStructure == "Full"):
if DeltaStructure == "Full":
[U, s, V] = utils.SVD(M)
S = np.diag(s)
delta = 1/s[0] * V[:,0] * U[:,0].H
elif (DeltaStructure == 'Diagonal'):
elif DeltaStructure == 'Diagonal':
# TODO: complete
delta = 'NA'
else: delta = 0
Expand Down

0 comments on commit 86b5bbd

Please sign in to comment.