I am wondering how to shift the center frequency of the below complex data from 0, to say 20 MHz (10 MHz to 30 MHz- 20 MHz bandwidth). I tried to change the indexing of the bins but I could not get it to shift. I understand fftshift shifts frequencies about 0 Hz, any way to shift the whole spectrum to something other than 0?

nFFTSize = 64;
subcarrierIndex = [-26:-1 1:26];
nBit = 1000; 
ip = rand(1,nBit) > 0.5; 
nBitPerSymbol = 52;
nSymbol = ceil(nBit/nBitPerSymbol);

ipMod = 2*ip - 1; 
ipMod = [ipMod zeros(1,nBitPerSymbol*nSymbol-nBit)];
ipMod = reshape(ipMod,nSymbol,nBitPerSymbol);

st = []; 

for ii = 1:nSymbol

inputiFFT = zeros(1,nFFTSize);

% assigning bits a1 to a52 to subcarriers [-26 to -1, 1 to 26]
inputiFFT(subcarrierIndex+nFFTSize/2+1) = ipMod(ii,:);

%  shift subcarriers at indices [-26 to -1] to fft input indices [38 to 63]
inputiFFT = fftshift(inputiFFT); 

outputiFFT = ifft(inputiFFT,nFFTSize);

% adding cyclic prefix of 16 samples 
outputiFFT_with_CP = [outputiFFT(49:64) outputiFFT];

st = [st outputiFFT_with_CP]; 


st2 = st*exp(2*pi*20*i*.0000032);

scatterplot(st2), grid;

enter image description here


1 Answer 1


You can shift your spectrum in the time domain by multiplying it with a complex exponential. It is the same way you implement an AM modulator.

Let $A(t)$ be an unspecific baseband signal. You multiply in time domain with a complex exponential and the result will be the bandpass signal: $$ y(t) = A(t)e^{j2\pi ft} = A(t)*\cos(2\pi ft) + j*A(t) \sin(2 \pi ft) $$ Since cos and sin both contain only a single frequency component, a fourier transform (if you look at the real part) will result in two impulses at $\pm f$ and the spectrum of $A(t)$ shifted to $\pm f$.

The same applies to your problem: Multiply your time domain signal with a complex exponential of the desired frequency offset and you will observe your spectrum to be shifted down.

  • $\begingroup$ Thanks for the suggestion, I have tried to implement a shift this way and it is still remaining at a center frequency of zero. I am shifting the matrix after the IFFT so the data should be in the time domain. I tried implementing using exponentials and sinusoids. IQ2 = IQcos(2*pi*20)+iIQsin(2*pi*20); or IQ2 = IQexp(i*2*pi*20); $\endgroup$ Commented Jun 27, 2016 at 1:14
  • $\begingroup$ you just need to include a time index in your exp(i*2*pi*20*t) expression. $\endgroup$ Commented Jun 27, 2016 at 4:41
  • $\begingroup$ How do I know what the time dependence is to use in the complex exponential after the IFFT? In the script all I am specifying is bits and eventually sampling rate when plotting the complex data. $\endgroup$ Commented Jun 27, 2016 at 11:32
  • $\begingroup$ Each time sample indexes by the sampling rate, and the total time duration is based on the length of your FFT (the lengths will match). The FFT is the frequency samples from 0 up to the sampling rate (actually one sample less than the sampling rate). Does that help? $\endgroup$ Commented Jun 27, 2016 at 13:24
  • $\begingroup$ Yes it does but I am not seeing any shift in my frequency spectrum. I add a shift of the complex data after the for loop IQ2 = IQexp(2*pi*20*i.0000032); for 20 MHz bandwidth, 64 IFFT length and 20 MHz clock but the spectrum is still 0 +/-10MHz. Nothing that I add is shifting the spectrum. I added a scatter plot to the code. $\endgroup$ Commented Jun 28, 2016 at 1:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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