6 unsigned int a_windowSize
10 int numRtnSamples = a_length;
12 double* rtrnPtr =
new double[numRtnSamples];
20 for(
int iS =0;iS < a_windowSize;iS++)
22 avg +=
static_cast<double>(a_signal[iS]);
25 for(
int iS =0;iS < a_windowSize;iS++)
27 rtrnPtr[iS] = avg/
static_cast<double>(a_windowSize);
29 for(
int iS =a_windowSize; iS < numRtnSamples;iS++)
32 avg -=
static_cast<double>(a_signal[iS-a_windowSize]);
34 avg +=
static_cast<double>(a_signal[iS]);
36 rtrnPtr[iS] = avg/
static_cast<double>(a_windowSize);
49 unsigned int a_length,
50 unsigned int a_windowSize,
51 unsigned int a_numIter
54 double* smoothedInput = simpleMovingAverage(a_signal,
57 for(
int iI = 0; iI < a_numIter;iI++)
59 double* tmpPtr = smoothedInput;
72 unsigned int a_length,
77 int numRtnSamples = a_length;
79 double* rtrnPtr =
new double[numRtnSamples];
81 rtrnPtr[0] =
static_cast<double>(a_signal[0]);
82 for(
int iS =1;iS < a_length;iS++)
84 rtrnPtr[iS] = (1-a_xDecay)*
static_cast<double>(a_signal[iS])
85 +a_xDecay*rtrnPtr[iS-1];
92 unsigned int a_length,
97 int numRtnSamples = a_length;
99 double* rtrnPtr =
new double[numRtnSamples];
101 rtrnPtr[0] =
static_cast<double>(a_signal[0]);
102 for(
int iS =1;iS < a_length;iS++)
104 rtrnPtr[iS] = 0.5*(1+a_xDecay)*
static_cast<double>(a_signal[iS])
105 -0.5*(1+a_xDecay)*
static_cast<double>(a_signal[iS-1])
106 +a_xDecay*rtrnPtr[iS-1];
113 unsigned int a_length,
118 int numRtnSamples = a_length;
120 double* rtrnPtr =
new double[numRtnSamples];
122 double av4FirstSamples =
static_cast<double>((a_signal[0]+a_signal[1]
123 +a_signal[2]+a_signal[3])/4.);
124 rtrnPtr[0] = av4FirstSamples;
125 rtrnPtr[1] = av4FirstSamples;
126 rtrnPtr[2] = av4FirstSamples;
127 rtrnPtr[3] = av4FirstSamples;
128 double coeff1 = pow(1-a_xDecay,4);
129 double coeff2 = 4*a_xDecay;
130 double coeff3 = -6*a_xDecay*a_xDecay;
131 double coeff4 = 4*pow(a_xDecay,3);
132 double coeff5 = -pow(a_xDecay,4);
133 for(
int iS =4;iS < a_length;iS++)
135 rtrnPtr[iS] = coeff1*
static_cast<double>(a_signal[iS])
136 +coeff2*rtrnPtr[iS-1]
137 +coeff3*rtrnPtr[iS-2]
138 +coeff4*rtrnPtr[iS-3]
139 +coeff5*rtrnPtr[iS-4];
146 unsigned int a_length,
152 int numRtnSamples = a_length;
154 double* rtrnPtr =
new double[numRtnSamples];
155 for(
int iS =0;iS < a_length;iS++)
159 rtrnPtr[iS] =
static_cast<double>(a_signal[iS]);
163 rtrnPtr[iS] =
static_cast<double>(a_signal[iS])
166 - rtrnPtr[iS-a_k-a_m]
167 + rtrnPtr[iS-2*a_k-a_m];
175 unsigned int a_length,
182 double* slowTrap = trapezoidalFilter(a_signal,a_length,a_kSlow,a_mSlow);
183 double* fastTrap = trapezoidalFilter(a_signal,a_length,a_kFast,a_mFast);
187 for(
int iS=0;iS<a_length;iS++)
189 if(slowTrap[iS]>maxSlow)
191 maxSlow = slowTrap[iS];
193 if(fastTrap[iS]>maxFast)
195 maxFast = fastTrap[iS];
198 return maxSlow/maxFast;
Definition: SignalProcessing.h:10
static double * singlePoleHighPassFilter(T *a_signal, unsigned int a_length, double a_xDecay)
Definition: SignalProcessing.hpp:91
static double * simpleMovingAverage(T *a_signal, unsigned int a_length, unsigned int a_windowSize)
Definition: SignalProcessing.hpp:4
static double * iterativeMovingAverage(T *a_signal, unsigned int a_length, unsigned int a_windowSize, unsigned int a_numIter)
Definition: SignalProcessing.hpp:48
double calculateTIPS(T *a_signal, unsigned int a_length, int a_kFast, int a_mFast, int a_kSlow, int a_mSlow)
Definition: SignalProcessing.hpp:174
static double * trapezoidalFilter(T *a_signal, unsigned int a_length, int a_k, int a_m)
Definition: SignalProcessing.hpp:145
static double * fourStageLowPassFilter(T *a_signal, unsigned int a_length, double a_xDecay)
Definition: SignalProcessing.hpp:112
static double * singlePoleLowPassFilter(T *a_signal, unsigned int a_length, double a_xDecay)
Definition: SignalProcessing.hpp:71