Solution (source code)

= Solution

Continuity of $y$ and integration across the impulse show that $y'$ jumps by one. Since $f'=-g-\kappa f$ and $g'=f-\kappa g$, evaluation just before and after $(n+1)T$ gives
$$
\binom{C_{n+1}}{D_{n+1}}=
\begin{pmatrix}f(T)&g(T)\\-g(T)&f(T)\end{pmatrix}
\binom{C_n}{D_n}+\binom01.
$$