Skip to content

Instantly share code, notes, and snippets.

@edy555
Last active October 12, 2017 17:13
Show Gist options
  • Save edy555/9677574 to your computer and use it in GitHub Desktop.
Save edy555/9677574 to your computer and use it in GitHub Desktop.
simulating CIC filter and modified one in python
#!/usr/bin/env python
import numpy as np
from pylab import *
x = np.random.randn(65536)
m=16
d0 = [0] * m
d1 = [0] * m
d2 = [0] * m
y = []
s0 = 0
s1 = 0
s2 = 0
x.shape = (len(x)/2,2)
for xi in x:
s0 += xi[0]+xi[1]
s1 += s0
s2 += s1
d0.append(s2)
d1.append(d0.pop(0) - d0[-1])
d2.append(d1.pop(0) - d1[-1])
y.append(d2.pop(0) - d2[-1])
psd(y)
show()
#!/usr/bin/env python
import numpy as np
from pylab import *
x = np.random.randn(65536)
m=16
d0 = [0] * m
d1 = [0] * m
d2 = [0] * m
y = []
s0 = 0
s1 = 0
s2 = 0
for xi in x:
s0 += xi
s1 += s0
s2 += s1
d0.append(s2)
d1.append(d0.pop(0) - d0[-1])
d2.append(d1.pop(0) - d1[-1])
y.append(d2.pop(0) - d2[-1])
psd(y)
show()
@edy555
Copy link
Author

edy555 commented Mar 21, 2014

CIC

modified CIC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment