What boundary conditions would you enforce when the frequency step changes? I'd think you'd want to enforce continuity as well as sign of slope. Phase, which you haven't used, is the only parameter to adjust. Or, if you also included amplitude you could match the slope as well. Meanwhile, you must keep track of the total time and plot time versus

amplitude *sin(time*frequency + phase)

to visualize the solution. I use gnuplot for graphics, although the graphics supplied along with scipy are exceedingly capable.

Code:

import math
from math import pi,sin
time_delta = 0
for Freq in range(1,11):
Freq*=0.1
#print ("current freq", Freq)
time_delta = 0
while time_delta <= 10.0:
w=2*pi*Freq
y= sin(w*time_delta)+2
time_delta = time_delta +0.1
print y

Tweet This+ 1 thisPost To Linkedin