/************************************************************************** * datamov - This function updates signal vector vector stored as * [x(n) x(n-1) ... x(n-N+1)] for FIR filters **************************************************************************/ void datamov(x, N, new) float *x; // signal vector int N; // filter length float new; // new sample { int i; // index for (i=N-1; i>0; --i) { x[i] = x[i-1]; // shift old data x(n-i), i = 1, 2, ... N-1 } x[0] = (float)new; // insert new data to x(n) }