python - np.correlate() and signal.fftconvolve() gave different answers -
i have 10 frames of wcdma complex samples in sigi scrambling code -- matlab gold code (1,1) , "sc" variable. np.correlate() gives clean correlation spikes expected in code below extremely slow. try use fftconvolve() in same code, detected no spikes present. fftconvolve() fast, have work. please tell me why not work?
mat=scipy.io.loadmat('011.mat') scr=mat['sc'] o1 = np.correlate(sigi,scr,mode='valid') # o1=signal.fftconvolve(sigi,scr,mode='valid') plot(abs(o1)) cc=max(abs(o1)) print ' max peak = ', cc
found answer. if conjugate of scr used both np.correlation() , signal.fftconvolve() give same answer. dont understand reason though??
scr=np.conjugate(scr[0,:]) o1=signal.fftconvolve(sigi,scr[::-1],mode='valid')
gave same answer :
scr=scr[0,:] o1=np.correlate(sigi,scr,mode='valid')
at least, problem solved.
Comments
Post a Comment