daily pastebin goal
5%
SHARE
TWEET

Untitled

a guest Dec 10th, 2018 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #k=f12.size+f24.size
  2. k=(f12.size+f24.size)*100
  3. tp1,tp2,tp3,tp4,tp5=np.zeros(k),np.zeros(k),np.zeros(k),np.zeros(k),np.zeros(k)
  4. ytot=np.zeros(k)
  5.  
  6. cnt=0
  7. for b in range(0,2):
  8.     if b==0:
  9.         n=f12.size
  10.         y1224=y12
  11.     else:
  12.         n=f24.size
  13.         y1224=y24
  14.     for a in range (0,n):
  15.         file = str(f12[a])
  16.         if int(file)>99:
  17.             matdata = scipy.io.loadmat(direc+file+'.mat')
  18.             DE = np.array(matdata['X'+file+'_DE_time']).T
  19.         else:            
  20.             matdata = scipy.io.loadmat(direc+file+'.mat')
  21.             DE = np.array(matdata['X0'+file+'_DE_time']).T
  22.  
  23.  
  24.         x = np.fft.fft(DE)
  25.         Nd = DE.size
  26.         x2 = 2.0/Nd*np.abs(x[1:Nd//2])
  27.  
  28.         Tm=1024 # Establecer el tamaño de la muestra de cada señal
  29.         #Nm=DE.size//Tm # Numero de muestras
  30.         #Nm=100 # Valor establecido por caso de ejemplo
  31.         N=Tm
  32.  
  33.         Ini=0
  34.         Fin=Tm
  35.  
  36.         for c in range (0,Tm):
  37.  
  38.             F_DE=x2[0, Ini:Fin]
  39.  
  40.             tp1[cnt]=F_DE.mean()
  41.             tp2[cnt]=np.sum(np.absolute(F_DE))/N
  42.             tp3[cnt]=np.sum(np.power(np.absolute(F_DE-tp2[a]), 2))/(N-1)
  43.             tp4[cnt]=np.sum(np.power(np.absolute(F_DE-tp2[a]), 3))/(N*(np.power(tp3[a],3/2)))
  44.             tp5[cnt]=np.sum(np.power(np.absolute(F_DE-tp2[a]), 4))/(N*(np.power(tp3[a],2)))
  45.  
  46.  
  47.             ytot[cnt]=y1224[a]
  48.  
  49.             cnt=cnt+1
  50.             Ini=Ini+Tm
  51.             Fin=Fin+Tm
  52. tp1 = np.asmatrix(tp1)
  53. tp2 = np.asmatrix(tp2)
  54. tp3 = np.asmatrix(tp3)
  55. tp4 = np.asmatrix(tp4)
  56. tp5 = np.asmatrix(tp5)
  57.  
  58. ytot = np.asmatrix(ytot)
  59.    
  60. IndexError                                Traceback (most recent call last) <ipython-input-22-5bd17573a3b8> in <module>()
  61.      36         for c in range (0,Tm):
  62.      37
  63. ---> 38             F_DE=x2[0, Ini:Fin]
  64.      39
  65.      40             tp1[cnt]=F_DE.mean()
  66.  
  67. IndexError: index 0 is out of bounds for axis 0 with size 0
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top