Variable sine wave source

A variable sine wave source is easy to implement as long as you stay away from a very common pitfall.

V(t) = sin(w*t+phi).

When we first look at this equation we think the best course of action is to simply change w, where w = 2piFrequency. While keeping the other parts mainly ‘t’ constant. If you do this you are going to get into a lot of trouble. 2 sine waves with different frequencies only ever have the same slope and same V(t) value at a few points if any over many cycles. If you switch frequencies while keeping ‘t’ constant you will have discontinuities in V(t). You must treat the wt+phi term as a “lump angle” term theta, and you must change theta at the rate of the frequency you want to operate at. To accomplish this we need an integral that will ramp from 0-2pi in the period of the frequency we want. This is easy to do, have a look at the attached circuit.