I am trying to get a differential equation for a series RL circuit

includes a switch for my study.

Vi(t) ----- sw ----- R ----- L ----- Vo(t)

i(t) →

GND ------------------------------ GND

When the switch is on or off, it is so easy to get equations as follows;

OFF: di(t)/dt = -(R / L) i(t) (Eq. 1)

ON: di(t)/dt = -(R / L) i(t) + (1 / L) {Vi(t) - Vo(t)} (Eq. 2)

I just want to simulate a broken switch, which can not turn off perfectly.

At first, I tried to replace the switch with a variable resistor "Rsw",

which ranges from 0 to larger value (maybe giga ohm).

Vi(t) ---- Rsw ----- R ----- L ----- Vo(t)

i(t) →

GND ------------------------------ GND

Then, a differential equation is derived as

di(t)/dt = -((R + Rsw) / L) i(t) + (1 / L) {Vi(t) - Vo(t)} (Eq. 3)

Eq. 3 is equal to Eq. 2 (switch is closed) when Rsw = 0, it is OK.

I believe that the Eq. 3 shall be equivalent to Eq. 1 (switch is opened)

when Rsw is quite large since the opened switch is like a resistor of which value is so large.

But, setting Rsw = ∞ doesn't give Eq. 1.

Where is the point that I am missing?

I need a equation that simulates opened / closed / half opened switch by alter Rsw dynamically.