add variables to control cycle resolution and count
This commit is contained in:
parent
00adbb1cb4
commit
d1df8fdf97
@ -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__":
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user