Changed time_varying_sinwave to be a function.