Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- """
- Created on Thu Jan 24 12:12:31 2019
- @author: Student
- """
- from numpy import *
- from pylab import*
- from scipy.stats import *
- from scipy.signal import*
- import os
- close('all');
- # wczytanie sygnału
- os.chdir('C:\Users\Student\Documents\MATLAB')
- sygnal=fromfile('rtefakty.raw',dtype=float32)
- L=len(sygnal)
- macierz=reshape(sygnal,(L/24,24))
- fp=128.0
- N=L/24
- t=arange(0,N/fp,1/fp)
- macierz2=zeros(shape=(N,24))
- # Narysowanie surowych sygnałów
- figure(1)
- for i in arange(24):
- print i
- subplot(4,6,i+1)
- x=macierz[:,i]
- plot(t,x)
- #widma wszystkich sygnałów
- figure(2)
- for i in arange(24):
- print i
- subplot(4,6,i+1)
- x=macierz[:,i]
- [f,W]=periodogram(x,fp)
- semilogy(f,W)
- #filtracja elektrochemii artefaktor ruchowych i 50 hz
- figure(3)
- b=firwin(1505,1,pass_zero=False,nyq=fp/2)
- [N,Wn]=ellipord([49/(fp/2),51/(fp/2)],[49.5/(fp/2),50.5/(fp/2)],1,100,analog=False)
- [b2,a2]=ellip(N,1,100,Wn,btype='bandstop',analog=False,output='ba')
- for i in xrange(24):
- print i
- subplot(4,6,i+1)
- x=macierz[:,i]
- xF=filtfilt(b,1,x)
- xFF=filtfilt(b2,a2,xF)
- plot(f,xFF)
- # -*- coding: utf-8 -*-
- """
- Created on Thu Jan 24 12:12:31 2019
- @author: Student
- """
- from numpy import *
- from pylab import*
- from scipy.stats import *
- from scipy.signal import*
- import os
- close('all');
- # wczytanie sygnału
- os.chdir('C:\Users\Student\Documents\MATLAB')
- sygnal=fromfile('rtefakty.raw',dtype=float32)
- L=len(sygnal)
- macierz=reshape(sygnal,(L/24,24))
- fp=128.0
- N=L/24
- t=arange(0,N/fp,1/fp)
- macierz2=zeros(shape=(N,24))
- # Narysowanie surowych sygnałów
- figure(1)
- for i in arange(24):
- print i
- subplot(4,6,i+1)
- x=macierz[:,i]
- plot(t,x)
- #widma wszystkich sygnałów
- figure(2)
- for i in arange(24):
- print i
- subplot(4,6,i+1)
- x=macierz[:,i]
- [f,W]=periodogram(x,fp)
- semilogy(f,W)
- #filtracja elektrochemii artefaktor ruchowych i 50 hz
- figure(3)
- b=firwin(1505,1,pass_zero=False,nyq=fp/2)
- [N,Wn]=ellipord([49/(fp/2),51/(fp/2)],[49.5/(fp/2),50.5/(fp/2)],1,100,analog=False)
- [b2,a2]=ellip(N,1,100,Wn,btype='bandstop',analog=False,output='ba')
- for i in xrange(24):
- print i
- subplot(4,6,i+1)
- x=macierz[:,i]
- xF=filtfilt(b,1,x)
- xFF=filtfilt(b2,a2,xF)
- plot(f,xFF)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement