Hi Nick. Are you trying to produce a pulse, or a sine wave? Are you converting the PWM output back to analog with a filter?
You have two basic controls on a PWM: frequency and duty cycle. Generally with a micro you control these by setting the clock source and frequency, total PWM cycle period (or timer overflow counter in clock cycles), and the output compare value which determines the duty cycle. Your clock source should be high enough to give you the resolution and smallest PWM % increment you need, but then it is usually left fixed. So then you would control the output frequency with the timer overflow, and the pulse width/duty cycle with the output compare. Or if you filter the output, the duty cycle will control the analog output voltage. So your equation is good to produce a sine wave, you just need to figure out what values to write, and to which registers, for your particular device.