Yes you can write a script to do it, but I don't have time to work out the math for you. In order to plot a sine wave in Scripter use the Math.sin() function. You'll have to figure out the rest of the math so that it has the amplitude you want, the frequency you want and starts 90 degrees into the cycle... then just generate a CC event that is scaled appropriately. If I were going to write it I would just plot a CC event for every call to ProcessMIDI(), using the start beat number.
MBP i7 2.66ghz, MacPro 3.3ghzx12, OSX 10.12, Logic Pro 10, Mainstage3, too many plugins to list