Exemple #1
0
#conv_fast = fft.convolution(data,gaus)
#t1 = time.time()
#conv_slow = fft.convolution_slow(data_slow,gaus_slow)
#t2 = time.time()
#
#print("Fast: ", t2-t1, "Slow: ", t1-t0)
#
##plt.show()
#
## assigment 4 problem 3
N=20
N2=fft.pow2(N)
G=np.zeros(N2)
H=np.zeros(N2)

for i in range(0,round(.1*len(G)),1):
  G[i]=1
print(G)

for i in range(round(.4*len(H)),round(.6*len(H)),1):
  H[i]=1
print(H)
corr = fft.correlation(G,H)
print(corr)






Exemple #2
0
  t2[j] = j*dt2
  f2[j] = j
  if t2[j] <= 0.1:
    g2[j] = 1
    h2[j] = 0
  elif t2[j] <= 0.4:
    h2[j] = 0
    g2[j] = 0
  elif t2[j] <= 0.6:
    g2[j] = 0
    h2[j] = 1
  else:  
    h2[j] = 0
    g2[j] = 0
print("with N equal to " + str(N1))
print(fft.correlation(g1,h1))
print("with N equal to " + str(N2))
print(fft.correlation(g2,h2))
#fft.plot_c(f1[:0.5*N],[:N])

#ys = np.zeros(2*N)
#yf = np.zeros(2*N)


#sigma = PI / 16. / 2
#dsigma2 = 1. / (sigma*sigma)
#C = 1. / (np.sqrt(2.*PI)*sigma)
#I = 0
#for i in range(N):
#  x[i] = i*dx
#  f[i] = i