diff --git a/reverse_goertzel.py b/reverse_goertzel.py index 929ba84..ad0b6bd 100644 --- a/reverse_goertzel.py +++ b/reverse_goertzel.py @@ -28,16 +28,18 @@ def sinusoid(n, cycles=1): return result def main(): - cycles = 2 - signal = goertzel_sinusoid(cycles, 1, 1024, 1) - reference = np.array(sinusoid(1024, cycles)) + samp_per_cycle = 512 + cycles = 3 + len = cycles * samp_per_cycle + signal = goertzel_sinusoid(1, cycles, samp_per_cycle, 1) + reference = np.array(sinusoid(len, cycles)) error = reference - signal print("max error:", error.max()) - x = np.array(range(0, 1024)) + x = np.array(range(0, len)) plt.plot(x, signal) plt.plot(x, reference) plt.plot(x, error) - #plt.plot(x, error*1000/3) + #plt.plot(x, error*100) plt.show() if __name__ == "__main__":