2
$\begingroup$

I am implementing a BFSK frequency hopping system with TX and Rx modules. I am using Goertzel Algorithm at the receiver end to demodulate the data i.e. to determine the carrier frequency of the recevied signal data. Following is the implementation of the goertzel implementation:

float goertzel(int numSamples,int TARGET_FREQUENCY,int SAMPLING_RATE, float* modData)
{
int k,i;
float   floatnumSamples;
float   omega,sine,cosine,coeff,q0,q1,q2,result;

floatnumSamples = (float) numSamples;
k = (int) (0.5 + ((floatnumSamples * TARGET_FREQUENCY) / SAMPLING_RATE));
omega = (2.0 * 3.1416 * k) / floatnumSamples;
sine = sin(omega);
cosine = cos(omega);
coeff = 2.0 * cosine;

q0=0;
q1=0;
q2=0;
result=0;

for(i=0; i<numSamples; i++)
{
    q0 = coeff * q1 - q2 + modData[i];
    q2 = q1;
    q1 = q0;
}

result = sqrtf(q1 * q1 + q2 * q2 - q1 * q2 * coeff);
return result;
}

The implementation works well for a signal where the received signal is a real signal ( a set of float values). Would this algorithm still work for complex signals. The complex signal would be typically be represented by a set of float values, with each alternate element representing a real and imaginary value. In this case, how should the above goertzel function be used, should it be used to calculate the output for the real and imaginary components separately, or should it read the entire complex signal array elements in a sequence (both real and imaginary array elements) and then calculate the magnitude at the end of it. If not, can some please point me to how to get the goertzel output for a complex signal samples. I tried googling it but could not find anything concrete about how to use goertzel algorithm on complex signals.

Also, I wanted to ask one more thing. If my signal has carrier frequencies at both 4000 and -4000 Hz and a sampling frequency of 18000 Hz, then for a real signal as input, the goertzel output is the same for input frequency of 4000 Hz and 14000Hz (this is what should be). But since 4000 Hz and -4000Hz are one of my carrier frequencies, I am not able to determine whether the received signal is at 4000 Hz or -4000 Hz. Is there any method to do this without doing a frequency shift. I am able to differentiate using frequency shifting (multiplying the received signal with a sine wave before demodulating). But I am looking for a method to do this without using the frequency shift technique.

--Anshu

$\endgroup$
4
$\begingroup$

The Goertzel algorithm (which is really just an efficient way of calculating what amounts to a single DFT bin at an arbitrary location) is defined for complex input, just like the DFT. A real input signal is really just a special case where the imaginary part is equal to zero. As far as your last question is concerned, if your input signal is real, then its spectrum is conjugate symmetric. That means that the spectrum value at -4000 Hz is the conjugate of the value at +4000 Hz. If you want to differentiate between the two frequencies, you'll need a complex input signal.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.