90 likes | 283 Views
Biomedical Instrumentation. 생체의료공학과 2009103859 안흥기. QRS Detector. *Algorithm. or. | |. BPF. Digital Filter. QRS Detector. *LPF. Trnsfer function. int QRS_LPF( int x) { 함수 밖예써 소용없어지므로 Static int y1=0, y2=0, x[26], p=12;( 뒤에서부터 앞으로 ) int y; // 출력 x[p]=x[p+13]=x;
E N D
Biomedical Instrumentation 생체의료공학과 2009103859 안흥기
QRS Detector *Algorithm or | | BPF Digital Filter
QRS Detector *LPF • Trnsfer function int QRS_LPF(int x) { 함수 밖예써 소용없어지므로 Static inty1=0, y2=0, x[26], p=12;(뒤에서부터 앞으로) int y; //출력 x[p]=x[p+13]=x; y=x[p]-(x[p+6]<<1)+x[p+12]+(y1<<1)-y2; y2=y1; y1=y; if(--p<0) p=12; return(y>>5); // 32의 이득 }
QRS Detector *HPF • Transfer function • All pass filter –Low pass filter int QRS_HPF(int x) { Static intl1=0, x[66], p=32; intl; x[p]=x[p+33]=x; l=l1+x[p]-x[p+32]; l=l1; if(--p<0) p=32; return(x[p+16]-(l>>5)); }
QRS Detector *Derivative Transfer function 1 Transfer function 2 (not using Ringbuffer) intQRS_Derivative(int x) { Static int x1=0; inty; y=x-x1; x1=x; return(y); } intQRS_Derivative(int x) { Static int x1, x2, x3, x4; inty; y=[(x<<1)+x1-x3-(x4<<1)]>>3; x4=x3; x3=x2; x2=x1; x1=x; return(y); }
QRS Detector *Square & Absolute B. Abs Code A. Square Code int QRS_Square(intx) { return(); } intQRS_Abs(intx) { if(x<0) return(-x); else return(x); } 곱셈은 시간이 많이 걸림 프로그램에 영향을 안끼칠때 사용. Absolute로 대체
QRS Detector *Moving Window Integral Transfer Function (32개의신호, 개당5ms -> 160ms) int QRS_MWI(int x) { Static int x[32], p=0; static long sum=0; // integer 32개 더하면 범위 넘어설수도 있으므로. long ly; int y; if(++p==32) p=0; sum-=x[p]; // 제일 옛날 데이터 sum+=x; x[p]=x; ly=(sum>>5); if(ly>32400) y=32400; // long, int size때문에. else y=(int)ly; return(y); }
QRS Detector *자주 발생하는 오류 main() { int d1, d2, l1,l2 ; d1=Getdatach1(); d2=Getdatach2(); l1=MyLPF(d1); l2=MyHPF(d2); } Int MyLPF_1(int x) { static int x1, x2, x3, x4; x4=x3; x3=x2; x2=x1; x1=x; return(y); } Copy &paste Int MyLPF_2(int x) { static int x1, x2, x3, x4; x4=x3; x3=x2; x2=x1; x1=x; return(y); } Ch2의 LPF를 안만들고Ch1의 LPF에 같이 집어넣은것과 같음. Ch1, Ch2 전용 필터를 따로 만들어야함
Lecture Note 9 -OVER- Thank you for your attention!