From: Frank Mutter Date: Fri, 13 Jul 2018 17:25:38 +0000 (+0200) Subject: changed sign X-Git-Url: https://git.harvie.cz/?a=commitdiff_plain;h=refs%2Fpull%2F2%2Fhead;p=mirrors%2FPrograms.git changed sign --- diff --git a/c/goertzel/goertzel.c b/c/goertzel/goertzel.c index 19bfdf5..d13a874 100644 --- a/c/goertzel/goertzel.c +++ b/c/goertzel/goertzel.c @@ -29,7 +29,7 @@ float goertzel_mag(int numSamples,float TARGET_FREQUENCY,int SAMPLING_RATE, floa // calculate the real and imaginary results // scaling appropriately - real = (q2 - q1 * cosine) / scalingFactor; + real = (q1 * cosine - q2) / scalingFactor; imag = (q1 * sine) / scalingFactor; magnitude = sqrtf(real*real + imag*imag);