/* Midpoint Fraying and Splicing */ #include #include #include #include #define N 5 /* Half-signal length */ #define E 3 /* Must be less than N */ typedef float real; #ifndef PI # define PI 3.14159265358979323846264338327950288 # define PI2 1.57079632679489661923132169163975144 # define PI4 0.78539816339744830961566084581987572 #endif /* Print a vector of reals as one row. */ static void print_vector( const char *title, real *x, int n) { int i; printf("%s (dim=%d): ", title, n); for(i=0; i -1.0 ) if ( t >= 1.0 ) r = 1; else r = sin(0.25*PI*(sin(0.5*PI*t)+1.0)); return r; } /* Fraying a sampled signal at the point between uneg[-1] and upos[0]: */ void fray( real *uneg, /* Valid indices: -e,...,-2,-1 */ real *upos, /* Valid indices: 0,1,...,e-1 */ int e) /* Reach of the indices */ { real rp, rn, up, un, t; int k; assert(e>=0); assert(uneg); assert(upos); for(k=0; k=0); assert(uneg); assert(upos); for(k=0; k