julian403
Full Member level 5
Hello All. I got this code from filter solution. Its a low pass filter of 4 order but I dont understand what is the states pointer.
float states [];
thats the function that I want to filter?
I get from the input ten values that I want to filter. I've to pass it to the filter by the array states? and what is invar??
This is the code
thanks for all in advance!
float states [];
thats the function that I want to filter?
I get from the input ten values that I want to filter. I've to pass it to the filter by the array states? and what is invar??
This is the code
Code:
float DigFil(invar, states)
float invar, *states;
/******************************************************************************/
/* Filter Solutions Version 2015 Nuhertz Technologies, L.L.C. */
/* www.nuhertz.com */
/* +1 602-279-2448 */
/* 4th Order Low Pass Butterworth */
/* Bilinear Transformation with Prewarping */
/* Sample Frequency = 50.00 KHz */
/* Standard Form */
/* Arithmetic Precision = 4 Digits */
/* */
/* Pass Band Frequency = 10.00 KHz */
/* */
/******************************************************************************/
/* */
/* Input Variable Definitions: */
/* Inputs: */
/* invar float The input to the filter */
/* *states float Pointer to array holding the filter states */
/* (Minimum array dimension: 4) */
/* */
/* Option Selections: */
/* Standard C; Externally Initialized; External States; Optimized; */
/* */
/******************************************************************************/
/* */
/* 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 znum[3] = {
4.658e-02,
.1863,
.2795
};
static float zden[4] = {
3.012e-02,
-.1827,
.68,
-.7821
};
sumnum = sumden = 0.0;
for (i=0;i<4;i++){
sumden += states[i]*zden[i];
sumnum += states[i]*znum[i<3?i:4-i];
if (i<3) states[i] = states[i+1];
}
states[3] = invar-sumden;
sumnum += states[3]*znum[0];
return sumnum;
}
thanks for all in advance!