TL;DR: You can find the source code HERE
This post will describe a numerical solving procedure in time-domain of a forced vibration from an harmonic excitation. I will keep the theory as short as possible, since there are plenty of other resources covering that. For example see HERE or HERE.

First, we introduce a new variable:


Taking the new variable into account with the equation of motion results to:


These equations can be written in matrix and vector shape:
We excite our system with its natural frequency…
… without friction
… with friction
and get: