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.

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=ARRAYVAL(J7)-(-0.2)
2=ARRAYVAL(K7)

J7 and K7 refere to x(2) and v(2) values from the solution array shown in Table 2, but what is ARRAYVAL? ARRAYVAL is one of the criterion functions that allow us to define dynamic constraints on the solution array. In this case we are simply picking a value from the solution but in general, a criterion function can be used to specify more complex constraint on the solution.

We evaluate the array formula =NLSOLVE(C1:C2, (w, 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.

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 define the constraints using another criterion function ODEVAL which allows us to interpolate the solution values at any point.

Using ODEVAL, we modify the constraints formulas as shown in Table 5:

Table 5
C
1=ODEVAL(I2:I32,x,"INTERP",2.5)-(-0.2)
2=ODEVAL(I2:I32,v,"INTERP",2.5)

The first argument to ODEVAL, is the time vector from the solution array in Table 2. The 2nd argument is the name of the variable we want to operate on. The 3rd argument is the operation (here interpolation), and the 4th argument is the time value we want to interpolate at.

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 9286286, 9892108, 10114812 and pending.
© 2015-2019, ExcelWorks LLC
Boston, USA