Customizing a Second Order Dynamical System

d2xdt2+2ζωdxdt+ω2x=0

The above classical textbook equation describes a 2nd order dynamical system. In this formulation, x(t) represents the displacement, ω represents the natural frequency, and ζ represents the damping ratio. To simulate this system with IVSOLVE, we transform it to two first order equations:

dxdt=v dvdt=-2ζωv-ω2x

Using the named variables and initial values, we define the input to IVSOLVE as shown in Table 1.

Table 1
ABCD
1Variables with initial valuesParameters
2tomega1
3x1zeta0.25
4v0
5Equations
6dx/dt=v
7dv/dt=-2*zeta*omega*v-omega^2*x

Next, we evaluate the array formula =IVSOLVE(B6:B7, (t,x,v), {0,12}) in array I1:K41 and obtain the solution shown Table 2 and plotted in Figure 1.

Note. ExceLab 365 users pass system variables by range reference B2:B4 or as "(t,x,v)" . Google Sheets users pass by range reference or as {t,x,v}

Table 2
IJK
1txv
2010
30.40.926057-0.35295
40.80.733004-0.59143
51.20.470053-0.70204
61.60.187507-0.69215
72-0.07064-0.585
82.4-0.2719-0.41357
92.8-0.39777-0.21403
103.2-0.4439-0.02004
113.6-0.418150.14165
124-0.337230.253773
134.4-0.222730.309249
144.8-0.097110.31042
155.20.0196320.26696
165.60.1124060.193178
1760.1722750.10513
186.40.196640.018001
196.80.188456-0.05592
207.20.154784-0.10843
217.60.105069-0.13591
2280.049333-0.13896
238.4-0.00336-0.12157
248.8-0.04602-0.08994
259.2-0.07437-0.05117
269.6-0.08693-0.01211
2710-0.084780.021603
2810.4-0.070880.046117
2910.8-0.049360.059586
3011.2-0.024680.062088
3111.6-0.000940.055252
32120.0186270.041749
Figure 1

The solution shows that the system is underdamped with an absolute overshoot over 0.4 at approximately a peak time of 3.3. In this exercise, we will customize the system response by optimizing ζ and ω to achieve an absolute overshoot of exactly 0.2 at t = 2.0.

Solution

We define two constraints on the solution obtained in Table 2 to demand that x(2) = -0.2 and v(2) = 0, then use NLSOLVE to solve for ω and ζ that staisfy these constraints. The two constraint formulas are shown in Table 3.

Table 3
C
1=DYNVAL(J7)-(-0.2)
2=DYNVAL(K7)

J7 and K7 refer to x(2) and v(2) values respectively from the solution array shown in Table 2. Note that we use DYNVAL to select the values from the solution array. DYNVAL is a dummy function that simply returns the value of its argument but in this context, it ensures that its argument is dynamically evaluated during the optimization.

We evaluate the array formula =NLSOLVE(C1:C2, (omega, zeta)) in array D1:E5 and obtain the solution shown in Table 4 and plotted in Figure 2. The new solution has an absolute overshoot of 0.2 at t=2 as desired.

Note. ExceLab 365 users pass omega and zeta variables by range reference D2:D3. Google Sheets users pass by range reference or as {omega,zeta}

Table 4
DE
1omega1.76493157
2zeta0.455950294
3SSERROR7.61331E-12
4ITRN11
5TIME(s)0.283
Figure 2

Exercise

What if we wanted our peak time to be at 2.5 instead of 2. Our solution array in Table 1 does not list the output point t=2.5. We have two options:

  1. We can format the output to display the solution at t=2.5 (See Output Format section in IVSOLVE help page).

  2. We modify the constraint formulas in Table 3 by employing INTERPXY to interpolate x and v at t = 2.5 as shown in Table 5.

Table 5
C
1=INTERPXY(I2:I32,DYNVAL(J2:J32),2.5)-(-0.2)
2=INTERPXY(I2:I32,DYNVAL(K2:K32),2.5)

Note that we use DYNVAL to select the displacement and velocity columns from the solution array because we want to use their dynamic values during the optimization. The time column values are static, therefore, we can select its values directly.

Please note. DYNVAL is a new function available in ExceLab 7.0 and later versions only. It replaces deprecated Criterion Functions used in earlier versions.

Using the same formula but with updated constraint formulas, NLSOLVE computes the new solution shown in table 6 Below and plotted in Figure 3. Note that the peak time has shifted to 2.5.

Table 6
DE
1omega1.411995975
2zeta0.455958508
3SSERROR1.55938E-25
4ITRN8
5TIME(s)0.152
Figure 3
Question or Comment? Email us:
support @ excel-works.com

ExceLab: Transforming Excel into a Calculus Power House

ExceLab functions and methods are protected by USA Patents 10628634, 10114812, 9892108 and 9286286.

© 2015-2022, ExcelWorks LLC
Boston, USA