goertzel.c
// Same as goertzel() but with floats
Same as goertzel() but with floats
Same as goertzel () but with floats
float_complex goertzelf(float *x, int N, int k) {
    float w;
    float sinW, cosW, twoCosW;
    float s0, s1, s2;
    w = (2.0 * M_PI * k) / N;
    sinW = sin(w);
    cosW = cos(w);
    twoCosW = 2.0 * cosW;
    s0 = 0.0;
    s1 = 0.0;
    s2 = 0.0;
    for (int n = 0; n < N; n++) {
        s0 = x[n] + (twoCosW * s1) - s2;
        s2 = s1;
        s1 = s0;
    }
    return float_complex(cosW * s1 - s2, sinW * s1);
}
float_complex goertzelf ( float * x , int N , int k ) { float w ; float sinW , cosW , twoCosW ; float s0 , s1 , s2 ; w = ( 2.0 * M_PI * k ) / N ; sinW = sin ( w ) ; cosW = cos ( w ) ; twoCosW = 2.0 * cosW ; s0 = 0.0 ; s1 = 0.0 ; s2 = 0.0 ; for ( int n = 0 ; n < N ; n ++ ) { s0 = x [ n ] + ( twoCosW * s1 ) - s2 ; s2 = s1 ; s1 = s0 ; } return float_complex ( cosW * s1 - s2 , sinW * s1 ) ; }
Same as goertzel() but with floats
Same as goertzel () but with floats