daily pastebin goal
45%
SHARE
TWEET

Untitled

a guest Jan 24th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Thu Jan 24 12:12:31 2019
  4.  
  5. @author: Student
  6. """
  7.  
  8. from numpy import *
  9. from pylab import*
  10. from scipy.stats import *
  11. from scipy.signal import*
  12. import os
  13.  
  14. close('all');
  15. # wczytanie sygnału
  16.  
  17. os.chdir('C:\Users\Student\Documents\MATLAB')
  18. sygnal=fromfile('rtefakty.raw',dtype=float32)
  19. L=len(sygnal)
  20. macierz=reshape(sygnal,(L/24,24))
  21.  
  22. fp=128.0
  23. N=L/24
  24. t=arange(0,N/fp,1/fp)
  25. macierz2=zeros(shape=(N,24))
  26. # Narysowanie surowych sygnałów
  27. figure(1)
  28. for i in arange(24):
  29.     print i
  30.     subplot(4,6,i+1)
  31.     x=macierz[:,i]
  32.     plot(t,x)
  33. #widma wszystkich sygnałów
  34. figure(2)
  35. for i in arange(24):
  36.     print i
  37.     subplot(4,6,i+1)
  38.     x=macierz[:,i]
  39.     [f,W]=periodogram(x,fp)
  40.     semilogy(f,W)
  41. #filtracja elektrochemii artefaktor ruchowych i 50 hz
  42.     figure(3)
  43.     b=firwin(1505,1,pass_zero=False,nyq=fp/2)
  44.     [N,Wn]=ellipord([49/(fp/2),51/(fp/2)],[49.5/(fp/2),50.5/(fp/2)],1,100,analog=False)
  45.     [b2,a2]=ellip(N,1,100,Wn,btype='bandstop',analog=False,output='ba')
  46. for i in xrange(24):
  47.     print i
  48.     subplot(4,6,i+1)
  49.     x=macierz[:,i]
  50.     xF=filtfilt(b,1,x)
  51.     xFF=filtfilt(b2,a2,xF)
  52.     plot(f,xFF)
  53.    
  54.     # -*- coding: utf-8 -*-
  55. """
  56. Created on Thu Jan 24 12:12:31 2019
  57.  
  58. @author: Student
  59. """
  60.  
  61. from numpy import *
  62. from pylab import*
  63. from scipy.stats import *
  64. from scipy.signal import*
  65. import os
  66.  
  67. close('all');
  68. # wczytanie sygnału
  69.  
  70. os.chdir('C:\Users\Student\Documents\MATLAB')
  71. sygnal=fromfile('rtefakty.raw',dtype=float32)
  72. L=len(sygnal)
  73. macierz=reshape(sygnal,(L/24,24))
  74.  
  75. fp=128.0
  76. N=L/24
  77. t=arange(0,N/fp,1/fp)
  78. macierz2=zeros(shape=(N,24))
  79. # Narysowanie surowych sygnałów
  80. figure(1)
  81. for i in arange(24):
  82.     print i
  83.     subplot(4,6,i+1)
  84.     x=macierz[:,i]
  85.     plot(t,x)
  86. #widma wszystkich sygnałów
  87. figure(2)
  88. for i in arange(24):
  89.     print i
  90.     subplot(4,6,i+1)
  91.     x=macierz[:,i]
  92.     [f,W]=periodogram(x,fp)
  93.     semilogy(f,W)
  94. #filtracja elektrochemii artefaktor ruchowych i 50 hz
  95.     figure(3)
  96.     b=firwin(1505,1,pass_zero=False,nyq=fp/2)
  97.     [N,Wn]=ellipord([49/(fp/2),51/(fp/2)],[49.5/(fp/2),50.5/(fp/2)],1,100,analog=False)
  98.     [b2,a2]=ellip(N,1,100,Wn,btype='bandstop',analog=False,output='ba')
  99. for i in xrange(24):
  100.     print i
  101.     subplot(4,6,i+1)
  102.     x=macierz[:,i]
  103.     xF=filtfilt(b,1,x)
  104.     xFF=filtfilt(b2,a2,xF)
  105.     plot(f,xFF)
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