canonical_realization_1.c

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

C
25
字号
/* can.c - IIR filtering in canonical form */double can(M, a, L, b, w, x)              /* usage: y = can(M, a, L, b, w, x); */double *a, *b, *w, x;                     /* \(w\) = internal state vector */int M, L;                                 /* denominator and numerator orders */{       int K, i;       double y = 0;       K = (L <= M) ? M : L;              /* \(K=\max(M,L)\) */       w[0] = x;                          /* current input sample */       for (i=1; i<=M; i++)               /* input adder */              w[0] -= a[i] * w[i];       for (i=0; i<=L; i++)               /* output adder */              y += b[i] * w[i];       for (i=K; i>=1; i--)               /* reverse updating of \(w\) */              w[i] = w[i-1];       return y;                          /* current output sample */}

⌨️ 快捷键说明

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