# Transfer of the signal spectrum to zero frequency

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 = {
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 = {
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;
}


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 ... • cosf(2*PI*0... Is this intentional? – MBaz Jun 2 at 13:32
• @MBaz I don't understand ... What is the question? It will be 0, I just wrote it down for general view – red15530 Jun 2 at 13:35
• 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? – Marcus Müller Jun 2 at 14:30
• @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. – red15530 Jun 2 at 14:34
• 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. – Marcus Müller Jun 2 at 14:35