Esempio n. 1
0
import utilsplot
import matplotlib.pyplot as plt

from utils import tf

s = tf([1, 0])

#Figure 5.12
G = 4 / ((s - 1) * (0.02 * s + 1)**2)
Kc = [0.5, 1.25, 2.0]
tau = 1.25
K = (tau * s + 1) / (tau * s)

plt.figure('Figure 5.12')
utilsplot.freq_step_response_plot(G, K, Kc, 4, 'T')
plt.show()
Esempio n. 2
0
import matplotlib.pyplot as plt
import utilsplot

from utils import tf

s = tf([1, 0])

G = (-s + 1) / (s + 1)
Kc = [0.2, 0.5, 0.8]
K = ((s + 1) / s) * (1 / (0.05 * s + 1))

plt.figure('Figure 5.7')
utilsplot.freq_step_response_plot(G, K, Kc, 5, 'S')
plt.show()
import matplotlib.pyplot as plt
import utilsplot

from utils import tf

s = tf([1, 0])

#Figure 5.7
G = (-s + 1)/(s + 1)
Kc = [0.2, 0.5, 0.8]
K = ((s + 1)/s) * (1 / (0.05 * s + 1))

plt.figure('Figure 5.7')
utilsplot.freq_step_response_plot(G, K, Kc, 5, 'S')
plt.show()
import utilsplot
import matplotlib.pyplot as plt

from utils import tf

s = tf([1, 0])

# Figure 5.12
G = 4 / ((s - 1) * (0.02 * s + 1) ** 2)
Kc = [0.5, 1.25, 2.0]
tau = 1.25
K = (tau * s + 1) / (tau * s)

plt.figure("Figure 5.12")
utilsplot.freq_step_response_plot(G, K, Kc, 4, "T")
plt.show()
Esempio n. 5
0
import matplotlib.pyplot as plt
import utilsplot
import numpy as np

from utils import tf, feedback

s = tf([1, 0])

#Figure 5.8
G = (-s + 1)/(s + 1)
Kcs = [0.1, 0.5, 0.9]
K = -1*s/((1 + 0.02*s)*(1 + 0.05*s))

plt.figure('Figure 5.8')
utilsplot.freq_step_response_plot(G, K, Kcs, 0.2, 'S')

# Plot negative step response
t = np.linspace(0, 0.2, 1000)
u1 = np.ones(500)
u2 = np.zeros(500)
u = np.hstack((u1, u2))

plt.figure('Figure 5.8(b)')
plt.title('(b) Response to step in reference')
for Kc in Kcs:
    K2 = Kc * K
    T = feedback(G * K2, 1)
    tout, y, _ = T.lsim(u, t)    
    plt.plot(tout, y)

plt.plot(tout, u, color='black', linestyle='--', linewidth=0.25)