Research Article
Embedded System Based on an ARM Microcontroller to Analyze Heart Rate Variability in Real Time Using Wavelets
Code 2
C-code to eliminate the linear trend.
void arm_lineal_detrend_f32(float32_t y, int size) | float32_t a,b,c,d,e,f,x1,x2,C1,C2,determinant; | int i; | a=0;b=0;c=0;d=0;e=0;f=0; | x2=1; | determinant=0; | for (i=0; i<size; i++) | x1=((float32_t)i+1)/(float32_t)size; // create a slope | a=a+(x1x1); | b=b+x1; | c=c+x1; | d=d+x2; | e=e+(x1yi); | f=f+(x2yi); | | determinant = ad - bc; | if (isnan(determinant) isinf(determinant)) | return; | else | C1 = (ed - bf)/determinant; // resolve the System | C2 = (af - ec)/determinant; // to find the coefficients C1 and C2 | for (i=0; i<size; i++) | x1=((float32_t)i+1)/(float32_t)size; | yi=yi-(x1C1+C2); // remove lineal trend | | | |
|