0
$\begingroup$

There is a signal at a frequency of 6 kHz-6.5 kHz. Sample rate 40kHz. It is required to transfer it to zero frequency. I counted two arrays cos and sin:

cosarray[40] = {
  cosf(2 * PI * 0 / (40.0 / 6.0)),
  cosf(2 * PI * 1.0 / (40.0 / 6.0)),
  cosf(2 * PI * 2.0 / (40.0 / 6.0)),
  …
  };
sinarray[40] = {
  sinf(2 * PI * 0 / (40.0 / 6.0)),
  sinf(2 * PI * 1.0 / (40.0 / 6.0)),
  sinf(2 * PI * 2.0 / (40.0 / 6.0)),
  …
  };

Then, when a new value comes from the ADC, I do:

if (j != 39) {
  j++;
} else {
  j = 0;
}
res = sqrtf(((adcres * cosarray[j]) * (adcres * cosarray[j])) +
            ((adcres * sinarray[j]) * (adcres * sinarray[j])));

Then I pass "res" through a low-pass filter with a cutoff frequency of 500 Hz, but I do not see my signal.

I tried to first pass the I and Q channels through a low-pass filter, and only then I calculated the resulting vector, but the result is the same ...

Moreover, if I pass the original signal "adcres" through a 6-6.5 kHz bandpass filter, the signal is present there. Where did I go wrong? What am I doing wrong?

I just started to deal with the transfer of the spectrum and maybe I do not understand something and am doing it wrong ...

enter image description here

$\endgroup$
21
  • $\begingroup$ cosf(2*PI*0... Is this intentional? $\endgroup$ – MBaz Jun 2 at 13:32
  • $\begingroup$ @MBaz I don't understand ... What is the question? It will be 0, I just wrote it down for general view $\endgroup$ – red15530 Jun 2 at 13:35
  • $\begingroup$ I think I understand the code, but I don't understand the intention – your res, waht is it supposed to contain in the end? What's the formula that you want to have? $\endgroup$ – Marcus Müller Jun 2 at 14:30
  • $\begingroup$ @Marcus Müller At the end, I want to get a 6kHz frequency offset signal. That is, I need to select a useful signal that is at a frequency of 6-6.5 kHz. I want it to be at 0-500Hz. $\endgroup$ – red15530 Jun 2 at 14:34
  • 1
    $\begingroup$ but that's not what res is; res seems to be the square root of the power of the complex baseband signal, which, no surprise there, is exactly the same as the square root of the power of the unshifted signal. Write down the formula that you want to implement to explain your implementation, please. $\endgroup$ – Marcus Müller Jun 2 at 14:35

Your Answer

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

Browse other questions tagged or ask your own question.