fir_c.htm

来自「FIR 滤波器 C语言程序,可用于算法仿真,非常有用.」· HTM 代码 · 共 26 行

HTM
26
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0058)http://www.oxbad.com/DSP/maindoc/arithmetic_source/c/FIR.C -->
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2900.3492" name=GENERATOR></HEAD>
<BODY><PRE>/* fir.c - FIR filter in direct form */

double fir(M, h, w, x)                       /* Usage: y = fir(M, h, w, x); */
double *h, *w, x;                            /* \(h\) = filter, \(w\) = state, \(x\) = input sample */
int M;                                       /* \(M\) = filter order */
{                        
       int i;
       double y;                             /* output sample */

       w[0] = x;                             /* read current input sample \(x\) */

       for (y=0, i=0; i&lt;=M; i++)
              y += h[i] * w[i];              /* compute current output sample \(y\) */

       for (i=M; i&gt;=1; i--)                  /* update states for next call */
              w[i] = w[i-1];                 /* done in reverse order */

       return y;
}
</PRE></BODY></HTML>

⌨️ 快捷键说明

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