matlab - Python Calculating PSD and CSD of ONE Array -


i got problem in signal analysis. load array in script (x) shape of x(68, 815). 68 represent number of signals in array. want perform psd , csd on like. csd: x[0] x[1] .... x[0] x[67] , following... x[1] x[1] .... x[1] x[67] , on

but somehow calculated values way of expectations , using them in further calculations leads disturbing results. can find mistake? lost atm. can't see tree forest.

x = np.load('/home/daniel/dropbox/[...]')  nfft = 512 n_freqs = nfft/2+1 n_epochs = len(x) # in case there 68 channels, not want change variable name sfreq = 1000  def compute_mean_psd_csd(x, n_epochs, nfft, sfreq):     '''computes mean of psd , csd signals.'''      rxy = np.zeros((n_epochs, n_epochs, n_freqs), dtype=complex)     rxx = np.zeros((n_epochs, n_epochs, n_freqs), dtype=complex)     ryy = np.zeros((n_epochs, n_epochs, n_freqs), dtype=complex)     in range(n_epochs):         j in range(n_epochs):             rxy[i,j], freqs = mlab.csd(x[i], x[j], nfft=nfft, fs=sfreq)             rxx[i,j], _____ = mlab.psd(x[i], nfft=nfft, fs=sfreq)             ryy[i,j], _____ = mlab.psd(x[i], nfft=nfft, fs=sfreq) 


Comments