# Frequency shift and phase shift (Doppler)

I'm trying to apply a frequency shift to a generated despreading code in order to find and track a broadcast signal CDMA. Expected doppler shift range of the signal from center frequency would be approx +/- 5KHz. Based on freq2 = c/(c-orbitspeed) * freq1.

I am wanting to shift the code based on equations, assuming data set is made of complex numbers.

N = sample size imaginary j = (0, 1) same as notation i new sample bin k = fft(generated code)[k] * e(-1 * j * 2 * PI * shift amount / N * k)

this "* j" makes the power an imaginary number part e() being the same as *10^power, 10 being a real number (10, 0j) do I need to follow the complex^complex rule to evaluate the e() expression? Then use the complex * complex to finish the product??

void adjust_CodeDoppler(int shift) // of fft data, apply fft in place first on gen_code
{
complex power;
complex e;
complex multiplier;
power.m_re = 0;
e.m_re = 10;
e.m_im = 0;
for(int n=0; n<N; n++)
{
power.m_im  = (-2*PI*shift/n*N); //*j part makes this the imag part of power
double ph = phaseAngleComp(e); //for (10, 0j) is always 0 = 0/10
double mg = magnatudeComp(e);  //for (10, 0j) is alwyas 10, sqrt( 10^2 + 0^2 )
multiplier.m_re = pow(mg, power.m_re) * exp(-1 * power.m_im * ph) * cos(power.m_re * ph + power.m_im * log(mg) ); //= 10^power real part
multiplier.m_im = pow(mg, power.m_re) * exp(-1 * power.m_im * ph) * sin(power.m_re * ph + power.m_im * log(mg) ); //= 10^power imag part
shift_gen_code[n] = multiplier * gen_code[n]; //using complex operator *
}
}

Seperately to affect phase shift in data, Is this done in time domain?? Can this be suffiecient to adjust phase offsets without changing a NCO/VCO on the quad mixer? Based on equations: also assuming data is alread I / Q A/D converted ph = phase angle n = bin position, time domain? Wc = expected center frequency Dpd = desired phase offset at time [] adjusted_ph = ph[n-1] + Wc + Dpd[n] //limit phase shift if(adjusted_ph[n] > 2* PI){adjusted_ph[n] = adjusted_ph[n] - 2*PI;}

• I don't have training in electrical engineering so a lot of stuff (such as NCO/VCO/CDMA) is unfamiliar to me, but I'm having a really hard time understanding what you wrote, or even what you're trying to do, other than that you're trying to counteract a Doppler shift. I think users would be more inclined to answer if you wrote in coherent sentences, used punctuation, explained abbreviations, and used LaTeX. – DumpsterDoofus Jan 17 '14 at 3:30
• I tried to edit it however it would not take the changes. Basically I receive in a signal in a small range. This is digitized into sign and magnatude I and Q bits representing the signal. Because there are many sources transmitting on the same center frequency, each source has a different spreading code or psudo noise code. In order to receive the actual data I must match a copy of the noise code in frequency and phase. Then by multiplication in frequency domain, the noise code is removed and only the data bits are left. I am wanting to do in the data what is often done in analog controls. – J Hinton Jan 17 '14 at 12:31
• The first part of the question is mainly about the correct way to do the complex number math in c++. So I'm trying to represent a number ie: 5e-21 as 5 * 10^-21. However the complex numbers have real parts (representing I data) and imaginary parts (Q data). I do know this is done in frequency domain. The second part is asking about making phase adjustments to the sample data. Do these types of adjustments happen in time or frequency domain? Can this totally replace adjusting the oscilator on the mixer before the A/D converter? – J Hinton Jan 17 '14 at 12:38
• I read through your code and tried to understand it, and (please don't take offense at this) I have to admit it's the most bizarre piece of code I've seen. Large parts of it, such as pow(mg, power.m_re), exp(-1 * power.m_im * ph), power.m_re * ph , etc. do absolutely nothing at all because they all automatically evaluate to either 0 or 1, and I'm completely baffled by your definitions such as $e=10$, or power.m_im = (-2*PI*shift/n*N). – DumpsterDoofus Jan 17 '14 at 17:07
• Also, multiplier.m_re evaluates to $\cos \left(\frac{2 \pi \text{N} \text{shift} \log (10)}{n}\right)$ and multiplier.m_im evaluates to $\sin \left(\frac{2 \pi \text{N} \text{shift} \log (10)}{n}\right)$, neither of which make any sense, with the most obvious problem being that the $N$ and the $n$ are in the wrong places, so this is a hyperbolically-changing phase shift (if there's even such a thing), not a constant-frequency phase shift. – DumpsterDoofus Jan 17 '14 at 17:09