fir_c.mht

来自「常用的DSP算法集锦」· MHT 代码 · 共 42 行

MHT
42
字号
From: <由 Microsoft Internet Explorer 5 保存>
Subject: 
Date: Wed, 27 Sep 2006 22:40:44 +0800
MIME-Version: 1.0
Content-Type: text/html;
	charset="gb2312"
Content-Transfer-Encoding: quoted-printable
Content-Location: http://www.oxbad.com/DSP/maindoc/arithmetic_source/c/FIR.C
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2962

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dgb2312">
<META content=3D"MSHTML 6.00.2900.2963" name=3DGENERATOR></HEAD>
<BODY><PRE>/* fir.c - FIR filter in direct form */

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

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

       for (y=3D0, i=3D0; i&lt;=3DM; i++)
              y +=3D h[i] * w[i];              /* compute current output =
sample \(y\) */

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

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

⌨️ 快捷键说明

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