Solve Example 1.9.2 using the Mathcad program.
The Mathcad program uses a fixed time step Runge–Kutta solution and returns the solution as a matrix with the first column consisting of the time step, the second column containing the response, and the third column containing the velocity response.
First type in the initial condition vector:
y : = y : = \left[\begin{array}{c} 0 \\ 0.25 \end{array}\right] |
Then type in the system in first-order form:
D(t, y):=D(t, y):=\left[\begin{array}{c} y_1 \\ -\left(\frac{1}{3} y_1\right)-\frac{2}{3} y_0 \end{array}\right] |
Solve using Runge–Kutta:
Z := rkfixed(y,0,20,1000,D) |
Name the time vector from the Runge–Kutta matrix solution:
t := Z^{<0>} |
Name the displacement vector from the Runge–Kutta matrix solution:
x := Z^{<1>} |
Name the velocity vector from the Runge–Kutta matrix solution:
dxdt := Z^{<2>} |
Plot the solutions.