I have some function $f(t,y)$ which behaves as follows: It is linear with gradient $g$ up to a time $T$ (i.e. $y = gt $). At time $T$ is suddenly switches to have gradient $g'$ which lasts for a time $dt$ before the gradient switches back to $g$. This behaviour repeats with period $T$
I want to approximate this behaviour via some analytical function. Whilst I could use some piecewise linear construction, I would prefer to have a continuous description, understanding that I will lose something in accuracy.
Can anyone suggest an appropriate form to approximate this function? My best approach so far involves taking the general gradient as
$$ g t \sin \left( \frac{2\pi}{T} t \right) + g t \cos \left( \frac{2\pi}{T} t \right)$$
but this doesn't give 'sharp' enough transitions between the two gradients, nor account for the timescale over which the two gradients last.
Any guidance greatly appreciated.