Skip to content

Instantly share code, notes, and snippets.

dt = 1e-6 #1MHz sampling
f_signal = 5e3 #5khz
SAMPLES_PER_PERIOD = 200
NPERIODS = 150
#Compute sinewave with relative accuracy:
t = range(0, dt, SAMPLES_PER_PERIOD)
sigT = 11.*sinpi(2*f_signal*t)
sig = zeros(SAMPLES_PER_PERIOD*NPERIODS)
for i in 1:NPERIODS