# Why do signal have mirror signal after pure frequency shift?

In my Matlab code I have a simple simulation of FPGA with the ability to simulate doppler shift, and after I and Q components plugged into IQmod with some carrier freq.

In my Matlab code when I multiply primordial signal $s_{prim}(t)e^{(jwt)}$ and have mirror signal after? And what's strange when I carrying that signal onto carrier frequency this carried signal doesn't have mirror signal.

totally working Matlab code included, will be glad to any ideas.

t = 0:0.000001:0.1;
fs = 1/(t(2) - t(1));
%ss = exp(j*2*pi*100*t) + exp(j*2*pi*200*t) + exp(j*2*pi*300*t) + exp(j*2*pi*900*t) + exp(j*2*pi*600*t); %Generating I-Q signal *.bin file for AWG

N=8;
bit_stream = round(rand(1,N));
f = 1000;
P1= 0;
P2= pi;
PSK_signal = [];

for ii = 1:1:N
PSK_signal = [PSK_signal (bit_stream(ii)==0)*sin(2*pi*f*t + P1)+...
(bit_stream(ii)==1)*sin(2*pi*f*t + P2)];
end

ss = PSK_signal;
figure(1); plot(ss);

sp = fft(ss);
N = length(ss);
fp = ((0:N-1)/(N-1))*fs;
fp = fp(1:N/2);
sp = abs(sp(1:N/2))/(N/2);
figure(2); hold on; plot(fp,sp); %Spectre of primordial signal

w = 3000*pi*2;
t = (1:length(ss))/fs;

%Real outputs from AWG
I = real(ss); % I Input on FPGA
Q = imag(ss); % Q Input on FPGA

%Adding frequency SHIFT in Simuation FPGA plate
ss_i_real = I.*cos(w*t) - Q.*sin(w*t); % I component from FPGA
ss_i_imag = I.*sin(w*t) + Q.*cos(w*t); % Q component from FPGA

sp = fft(ss_i_real+1j*ss_i_imag);
N = length(ss_i_real);
fp = ((0:N-1)/(N-1))*fs;
fp = fp(1:N/2);
sp = abs(sp(1:N/2))/(N/2);
figure(2);  plot(fp,sp);

w = 40000*pi*2;
t = (1:length(ss_i_real))/fs;

%ss_c = ss_i.*exp(1j*w*t); %Modulation that carrying signal from FPGA on Carrier Frequency (40KHz)
ss_c_real = ss_i_real.*cos(w*t) - ss_i_imag.*sin(w*t);
ss_c_imag = ss_i_real.*sin(w*t) + ss_i_imag.*cos(w*t);

ss_c = ss_c_real+ss_c_imag*1j; % Real part of Signal onto carrier <- this is the signal that will be transmitting from modulator

sp = fft(ss_c);
N = length(ss_c);
fp = ((0:N-1)/(N-1))*fs;
fp = fp(1:N/2);
sp = abs(sp(1:N/2))/(N/2);
figure(2); plot(fp,sp); %Spectre of signal onto carrier freq

% figure(4); plot(ss_c_real); %I - component of signal onto carrier freq
%
% figure(5); plot(ss_c_imag); %Q - component of signal onto carrier freq


edit1: What causes my confusion, when I'm using the signal:

 %ss = exp(j*2*pi*100*t) + exp(j*2*pi*200*t) + exp(j*2*pi*300*t) + exp(j*2*pi*900*t) + exp(j*2*pi*600*t); %Generating I-Q signal *.bin file for AWG


I have this nice picture:

1 primordial signal, 1 shifted signal and 1 carried onto 40KHz shifted signal. When I'm using the BPSK signal I'm shifting this signal I have mirrored signal and shifted (i mean two signals with $F_{shift} \pm F_{prim}$)

To be simple I just want to add shift on intermediate frequency and after carry that shifted signal onto carrying frequency without clone signal at $f_{car}-f_{shifted}$ as I have now.

• By the term mirror do you mean the orange twins in your first plot ( that you expect a single one instead of two?) – Fat32 Sep 8 '17 at 18:38
• @Fat32, yes, in Russian it's called primordial and mirrored signals. – qqffx Sep 8 '17 at 18:43
• Why are you expecting ss to be imaginary? You take the imaginary part of it, but I can't see why it should be complex-value. – Peter K. Sep 8 '17 at 18:45
• It's for some kind of versatility. For cases when I have ss with complex part too. – qqffx Sep 8 '17 at 18:47

Your code is (probably) ok. But your way of plotting is slightly wrong.

The complete spectrum of the baseband PSK signal would include two peaks one at positive frequency $f_0=1000$ and the other at negative frequency $f=-1000$. When you IQ modulate this signal with $f_m=3000$ you will create two twins one at $f_{11}=2000$ and $f_{12} = 4000$ and the other at the negative frequencies at $f_{21}=-2000$ and $f_{22} = -4000$.

Since you are taking only the first half of the FFT you do not observe the peaks at negative ones, which causes the confusion. If you plot the full spectrums, you can see the missing components at the second half that you omit...

t = 0:0.000001:0.1;
fs = 1/(t(2) - t(1));
%ss = exp(j*2*pi*100*t) + exp(j*2*pi*200*t) + exp(j*2*pi*300*t) + exp(j*2*pi*900*t) + exp(j*2*pi*600*t); %Generating I-Q signal *.bin file for AWG

N=8;
bit_stream = round(rand(1,N));
f = 1000;
P1= 0;
P2= pi;
PSK_signal = [];

for ii = 1:1:N
PSK_signal = [PSK_signal (bit_stream(ii)==0)*sin(2*pi*f*t + P1)+...
(bit_stream(ii)==1)*sin(2*pi*f*t + P2)];
end

ss = PSK_signal;
%figure(1); plot(ss); title('The PSK baseband signal');

ff = linspace(-fs/2,fs/2,length(ss));
figure,plot(ff,abs(fftshift(fft(ss))));
title('The PSK baseband SPECTRUM ');
% sp = fft(ss);
% N = length(ss);
% fp = ((0:N-1)/(N-1))*fs;
% fp = fp(1:N/2);
% sp = abs(sp(1:N/2))/(N/2);
% figure(2); plot(fp,sp); %Spectre of primordial signal
%title('The PSK baseband SPECTRUM ');

w = 3000*pi*2;
t = (1:length(ss))/fs;

%Real outputs from AWG
I = real(ss); % I Input on FPGA
Q = imag(ss); % Q Input on FPGA

%Adding frequency SHIFT in Simuation FPGA plate
ss_i_real = I.*cos(w*t) - Q.*sin(w*t); % I component from FPGA
ss_i_imag = I.*sin(w*t) + Q.*cos(w*t); % Q component from FPGA

sp = fft(ss_i_real+1j*ss_i_imag);  % computing the Spectrum of the ANALYTIC signal here! Hence the NEGATIVE frequencies are deleted.
figure,plot(ff,abs(fftshift(sp)));
title('IQ modulated signal FSK baseband');

% sp = fft(ss_i_real+1j*ss_i_imag);
% N = length(ss_i_real);
% fp = ((0:N-1)/(N-1))*fs;
% fp = fp(1:N/2);
% sp = abs(sp(1:N/2))/(N/2);
%figure(2);  plot(fp,sp);
%figure(3),plot(fp,sp); title('IQ modulated signal FSK baseband');

w = 40000*pi*2;
t = (1:length(ss_i_real))/fs;

%ss_c = ss_i.*exp(1j*w*t); %Modulation that carrying signal from FPGA on Carrier Frequency (40KHz)
ss_c_real = ss_i_real.*cos(w*t) - ss_i_imag.*sin(w*t);
ss_c_imag = ss_i_real.*sin(w*t) + ss_i_imag.*cos(w*t);

ss_c = ss_c_real+ss_c_imag*1j; % Real part of Signal onto carrier <- this is the signal that will be transmitting from modulator

sp = fft(ss_c);
N = length(ss_c);
fp = ((0:N-1)/(N-1))*fs;
fp = fp(1:N/2);
sp = abs(sp(1:N/2))/(N/2);
figure(4); plot(fp,sp); %Spectre of signal onto carrier freq
title('IQ modulated and up-mixed FSK signal');

% figure(4); plot(ss_c_real); %I - component of signal onto carrier freq
%
% figure(5); plot(ss_c_imag); %Q - component of signal onto carrier freq

• I'm little confused right now. Would u mind uncomment the first ss implementation with series of exponential sinusoids. And trying code with them? U will see, that in positive half of spectrum u have 1 primordial signal, 1 shifted signal, and 1 carried signal. Without mirrored part. – qqffx Sep 8 '17 at 18:54
• With bpsk signal I have in positive half of spectrum 1 primordial, 2 shifted and 1 carried shifted signal. And this is cause my confusion. – qqffx Sep 8 '17 at 18:55
• Yes clarified. As I said, in your first plot you seem to have a single peak but you actually have two, you don't plot the one at f=-1000 Hz. (it's located at the far right side of the FFT spectrum). By IQ modulating this signal with a cosine frequency of 3000 Hz. you shift the one at f=-1000 Hz to right by 3000 into a frequency of f=2000 Hz. The one at f=1000 Hz is shifted to f=4000 hz. At this point you take the analytic signal which deletes the netagive frequencies (those two peaks at f=-2000 and f=-4000 is deleted). So there is nothing wrong other than your interpretation. – Fat32 Sep 8 '17 at 19:11
• Again thanks u a lot! For you patience, and tolerance to my bad English) A bit of reading do the thing to me! – qqffx Sep 8 '17 at 19:57
• @qqffx No problem! you're welcome... – Fat32 Sep 8 '17 at 20:00