(a) Write a spreadsheet program to solve the equation m \ddot{z} + c \dot{z} + kz = F by the central difference method.
(b) Plot the displacement time history, z, with F = constant = 100 N; initial conditions z_{0} = \dot{z}_{0} = 0, and
m = 1 kg;
k = 10 000 N/m;
c = 20 N/m/s
Compare the plot with the exact answer from the expression derived in Example 2.3.
(a) Substituting Eqs (3.31) and (3.32) into the equation of motion, m\ddot{z} + c \dot{z} + kz = F, we have
z_{j+1} – z_{j-1} = 2h\dot{z}_{j} or rearranging: \dot{z}_{j} = \frac{z_{j+1} – z_{j-1}}{2h} (3.31)
z_{j+1} + z_{j-1} = 2z_{j} + h^{2}\ddot{z}_{j} or rearranging: \ddot{z}_{j} = \frac{z_{j+1} – 2z_{j} + z_{j-1}}{h^{2}} (3.32)
m\left(\frac{z_{j+1} – 2z_{j} + z_{j-1}}{h^{2}}\right) + c\left(\frac{z_{j+1} – z_{j-1}}{2h}\right) + kz_{j} = F_{j} (A)
Rearranging,
z_{j+1} = a_{1}z_{j} + a_{2}z_{j-1} + a_{3}F_{j} (B)
where
\begin{aligned}a_{1} = \frac{2m – kh^{2}}{\frac{1}{2}ch + m}, && a_{2} = \frac{\frac{1}{2}ch – m}{\frac{1}{2}ch + m} && a_{3} = \frac{h^{2}}{\frac{1}{2}ch + m} &&& (C) \end{aligned}The value of z_{-1} is taken from Eq. (3.26), i.e.
z_{j-1}=z_{j}-h\dot{z}_{j} + \frac{h^{2}}{2!}\ddot{z}_{j}-\frac{h^{3}}{3!} \overset{…}{z} _{j} + … (3.26)
(where ! indicates a factorial value, e.g. 3! = 3×2×1 = 6)
z_{-1} = z_{0} – h\dot{z}_{0} + \frac{h^{2}}{2}\ddot{z}_{0}where
z_{0} = \dot{z}_{0} = 0 and \ddot{z}_{0} = \frac{F_{0}}{m} – \frac{c}{m}\dot{z}_{0} – \frac{k}{m}z_{0}
from Eq. (3.34). Therefore,
\ddot{z}_{0} = \frac{F_{0}}{m} – \frac{c}{m}\dot{z}_{0} – \frac{k}{m}z_{0} (3.34)
z_{-1} = 0-0+\frac{h^{2}F_{0}}{2m}= \frac{h^{2}F_{0}}{2m} (D)
Table 3.4 is a spreadsheet to calculate z.
The constants a_{1}, a_{2} \mathrm{and} a_{3} are given by Eqs (C).
(b) Inserting the values of m, k and c, and initial conditions z_{0} = \dot{z}_{0} = 0, Fig. 3.9 is a plot of z using a step length h = 0.005 s, compared with the exact solution from the expression derived in Example 2.3.
Table 3.4 Spreadsheet for Central Difference Method | |||
j | t_{j} | F_{j} | z_{j} |
-1 | =hj | = \frac{h^{2}F_{0}}{2m} | |
0 | =hj | = F_{0} | = 0 |
1 | =hj | = F_{1} | = a_{1} z_{0}+a_{2} z_{-1}+a_{3} F_{0} |
2 | = F_{2} | = a_{1} z_{1}+a_{2} z_{-1}+a_{3} F_{1} | |
3 | ⁞ | ⁞ |