I am trying to write a modulation function, referring below function. I am not electrical engineer and doesn\'t know much about signal processing.