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
|
return result
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
cycles = 2
|
samp_per_cycle = 512
|
||||||
signal = goertzel_sinusoid(cycles, 1, 1024, 1)
|
cycles = 3
|
||||||
reference = np.array(sinusoid(1024, cycles))
|
len = cycles * samp_per_cycle
|
||||||
|
signal = goertzel_sinusoid(1, cycles, samp_per_cycle, 1)
|
||||||
|
reference = np.array(sinusoid(len, cycles))
|
||||||
error = reference - signal
|
error = reference - signal
|
||||||
print("max error:", error.max())
|
print("max error:", error.max())
|
||||||
x = np.array(range(0, 1024))
|
x = np.array(range(0, len))
|
||||||
plt.plot(x, signal)
|
plt.plot(x, signal)
|
||||||
plt.plot(x, reference)
|
plt.plot(x, reference)
|
||||||
plt.plot(x, error)
|
plt.plot(x, error)
|
||||||
#plt.plot(x, error*1000/3)
|
#plt.plot(x, error*100)
|
||||||
plt.show()
|
plt.show()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user