Skip to content

Commit ca37898

Browse files
committed
Update example, values taken from a book
1 parent 317d261 commit ca37898

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

examples/markov.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@ def create_impulse_response(H, time, transpose, dt):
4848
issiso=issiso)
4949

5050
# set up a mass spring damper system (2dof, MIMO case)
51-
# m q_dd + c q_d + k q = u
52-
m1, k1, c1 = 1., 1., .1
53-
m2, k2, c2 = 2., .5, .1
54-
k3, c3 = .5, .1
51+
# Mechanical Vibartions: Theory and Application, SI Edition, 1st ed.
52+
# Figure 6.5 / Example 6.7
53+
# m q_dd + c q_d + k q = f
54+
m1, k1, c1 = 1., 4., 1.
55+
m2, k2, c2 = 2., 2., 1.
56+
k3, c3 = 6., 2.
5557

5658
A = np.array([
5759
[0., 0., 1., 0.],
@@ -76,19 +78,19 @@ def create_impulse_response(H, time, transpose, dt):
7678
case "MIMO":
7779
sys = ct.StateSpace(A, B, C, D)
7880

79-
dt = 0.5
81+
dt = 0.25
8082
sysd = sys.sample(dt, method='zoh')
8183
sysd.name = "H_true"
8284

8385
# random forcing input
84-
t = np.arange(0,500,dt)
86+
t = np.arange(0,100,dt)
8587
u = np.random.randn(sysd.B.shape[-1], len(t))
8688

8789
response = ct.forced_response(sysd, U=u)
8890
response.plot()
8991
plt.show()
9092

91-
m = 100
93+
m = 50
9294
ir_true = ct.impulse_response(sysd,T=dt*m)
9395
ir_true.tranpose = True
9496

0 commit comments

Comments
 (0)