新手入门
- 积分
- 12
- 金钱
- 12
- 注册时间
- 2019-4-18
- 在线时间
- 1 小时
|
楼主 |
发表于 2019-4-18 15:20:48
来自手机
|
显示全部楼层
下面这些也是。。。但是错误总是不合适搞不清楚 float DigFil(invar, setic) float invar; int setic; /******************************************************************************/ /* Filter Solutions Version 2009 Nuhertz Technologies, L.L.C. */ /* www.nuhertz.com */ /* +1 602-279-2448 */ /* 3rd Order Band Pass Butterworth */ /* Bilinear Transformation with Prewarping */ /* Sample Frequency = 5.000 KHz */ /* Standard Form */ /* Arithmetic Precision = 4 Digits */ /* */ /* Center Frequency = 300.0 Rad/Sec */ /* Pass Band Width = 20.00 Rad/Sec */ /* */ /******************************************************************************/ /* */ /* Input Variable Definitions: */ /* Inputs: */ /* invar float The input to the filter */ /* setic int 1 to initialize the filter to zero */ /* */ /* Option Selections: */ /* Standard C; Initializable; Internal States; Not Optimized; */ /* */ /* There is no requirement to ever initialize the filter. */ /* The default initialization is zero when the filter is first called */ /* */ /******************************************************************************/ /* */ /* This software is automatically generated by Filter Solutions */ /* no restrictions from Nuhertz Technologies, L.L.C. regarding the use and */ /* distributions of this software. */ /* */ /******************************************************************************/ { float sumnum=0.0, sumden=0.0; int i=0; static float states[6] = {0.0,0.0,0.0,0.0,0.0,0.0}; static float znum[7] = { -7.968e-09, 0.0, 2.39e-08, 0.0, -2.39e-08, 0.0, 7.968e-09 }; static float zden[6] = { .992, -5.949, 14.88, -19.86, 14.92, -5.981 }; if (setic==1){ for (i=0;i<6;i++) states[i] = [i] = [i]*invar; return 0.0; } else{ sumnum = sumden = 0.0; for (i=0;i<6;i++){ sumden += states[i]*zden[i]; sumnum += states[i]*znum[i]; if (i<5) states[i] = states[i+1]; } states[5] = invar-sumden; sumnum += states[5]*znum[6]; return sumnum; } } |
|