fixed files
parent
b5ae8eb7a5
commit
dad60fe37a
Binary file not shown.
|
@ -0,0 +1,32 @@
|
|||
import numpy as np
|
||||
|
||||
x = [1,2,3]
|
||||
|
||||
h_1 = [1,1,1]
|
||||
|
||||
h2Length = 10
|
||||
h_2 = [(0.9**n) for n in range(h2Length + 1)]
|
||||
|
||||
print(h_2)
|
||||
|
||||
y_1 = np.convolve(x,h_1)
|
||||
y_2 = np.convolve(y_1,h_2)
|
||||
|
||||
y_1h2 = np.convolve(x,h_2)
|
||||
|
||||
|
||||
|
||||
print(y_1)
|
||||
print(y_2)
|
||||
print(y_1h2)
|
||||
|
||||
def GenStem(arr, padding = 2):
|
||||
print("n\txn")
|
||||
for i in range(padding):
|
||||
print(str(i-padding) + "\t0")
|
||||
for i in range(len(arr)):
|
||||
print(str(i) + "\t" + str(arr[i]))
|
||||
for i in range(padding):
|
||||
print(str(len(arr) + i) + "\t0")
|
||||
|
||||
GenStem(y_1h2)
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,23 @@
|
|||
import numpy as np
|
||||
|
||||
c_omega = {}
|
||||
c_k = {}
|
||||
|
||||
length = 5
|
||||
|
||||
def coeff(k, N):
|
||||
# print(1/N)
|
||||
omega = 2* np.pi * (k / N)
|
||||
tmp = (1/N) * (2 + 2*np.cos(omega))
|
||||
print(str(k) + "\t" + str(tmp)) # used to generate latex data
|
||||
return omega, tmp
|
||||
|
||||
print("n\t xn") # used to generate latex data
|
||||
|
||||
for i in range(-length, length + 1, 1):
|
||||
tmp = coeff(i, length * 2)
|
||||
c_omega[tmp[0]] = tmp[1]
|
||||
c_k[i] = tmp[1]
|
||||
|
||||
print(c_omega) # dict with coefficients with omega as axis
|
||||
print(c_k) # dict with coefficients with k as axis
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue