circular-buffer_canonical_realization_2.c

来自「DSP訊號處理的原始碼 開發工具為C和Matlab」· C语言 代码 · 共 25 行

C
25
字号
/* ccan2.c - circular buffer implementation of canonical realization */void wrap2();                        /* defined in Section \ref{hardware.sec} */double ccan2(M, a, b, w, q, x)double *a, *b, *w, x;                /* q = circular pointer offset index */int M, *q;                           /* a,b have common order M */{       int i;       double y = 0;       w[*q] = x;                               /* read input sample x */       for (i=1; i<=M; i++)              w[*q] -= a[i] * w[(*q+i)%(M+1)];       for (i=0; i<=M; i++)              y += b[i] * w[(*q+i)%(M+1)];       (*q)--;                                  /* update circular delay line */       wrap2(M, q);       return y;                                /* output sample */}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?