I'm learning Mathematica through examples given in Engineering Vibrations by Daniel J. Inman. However, there is a huge mistake given in this bit of code offered:
M = {{4, 0}, {0, 9}};
K = {{30, -5}, {-5, 5}};
f = {{0.235*Sin[ω*t]}, {2.97922 Sin[ω*t]}};
ω = 2.75655;
x = {{x1[t]}, {x2[t]}};
xdd = {{x1''[t]}, {x2''[t]}};
system = m.xdd + k.x;
num = NDSolve[
{system[[1]] == f[[1]],
x1'[0] == 0,
x1[0] == 0,
system[[2]] == f[[2]],
x2[0] == 0,
x2'[0] == 0},
{x1[t], x2[t]},
{t, 0, 20}
];
Plot[
{Evaluate[x1[t] /. num], Evaluate[x2[t] /. num]},
{t, 0, 20},
PlotStyle -> {RGBColor[1, 0, 0], RGBColor[0, 1, 0]},
PlotLegends -> {"x1[t]", "x2[t]"}
]
If I am to represent the matrix of time-dependent formulas for distance and acceleration, how am I suppose to do it?