# In the frequency domain of a phase-shift keyed signal, why there are are prominent frequency components which are multiples of sampling frequency?

In the frequency domain representation of a digital phase modulated signal, why there are prominent other frequency components which are multiples of the sampling frequency, other than the main carrier frequency ?

For example here I am using a sample frequency of 6000 Hz and 8 bits to quantize one sample. Then there are 48000 Bits per second so my phase modulation carrier wave need to be 48000 Hz right. So as expected in the frequency domain representation diagram there is 48000 Hz line with highest amplitude. But why there are other frequency lines that are multiples of 6000 Hz in that diagram?

This is MATLAB code I used to generate above diagram.

%Recording
qbits = 8; %number of bits used to sample one
Fs = 6000; %Sampling f
recObj = audiorecorder(Fs, qbits, 1);
disp("Start speaking");
recordblocking(recObj, 5); %Stops recording after 5s
disp("End of Recording")
audio_samples = getaudiodata(recObj);

%Quantizing
%analog to digital
Size = size(audio_samples);
size_audio_samples = Size(1); %total number of samples
number_of_bits = qbits * size_audio_samples;
bit_stream = zeros([1, number_of_bits]); %array which is used to represnt the binary representation

for  i = 1 : size_audio_samples
num = audio_samples(i,1);
if (num<0) %determining the sign bit
bit_stream(1,(i-1)* qbits +1) = 1;
else
bit_stream(1,(i-1) * qbits +1) = 0;
end
num = abs(num);
for j= 2: qbits %determining the rest of the bits using typical floating point decimals to binary method
num = 2* num;
if (num >= 1)
bit_stream(1, (i-1)*qbits + j) = 1;
num = num-1;
else
bit_stream(1, (i-1)*qbits + j) = 0;
end
end
end
%}

%Modulation
samples_per_bit = 100; %number of samples used to approximate  the sinosoid for a single bit

Amplitude = -5;
sampling_rate = Fs * qbits *  samples_per_bit;

fc = sampling_rate /samples_per_bit; % frquency of the sinusoid
Wc = 2 * pi* fc; %omega of the sinusoid
delt = 1/sampling_rate; %time period between two samples
phase0 = pi;
phase1 = 0;

number_of_samples = number_of_bits * samples_per_bit;
X = zeros([1, number_of_samples]); %this is going to be the discre time approximation of the actual signal that is gonna be transmitted

power = 10^(Amplitude/20); %signal power in watts
t_bit = delt : delt : delt*samples_per_bit;
bit1 = sqrt(power)* sin(Wc * t_bit + phase1) ;
bit0 = sqrt(power)* sin(Wc * t_bit + phase0) ; % these are two types of sampled phase shifted sinusoid power values

for i= 1: number_of_bits
if (bit_stream(i) ==1)
X(samples_per_bit*(i-1)+1 : samples_per_bit*i)= bit1;
else
X(samples_per_bit*(i-1)+1 : samples_per_bit*i)= bit0;
end
end

%Comparing the transmitted and received signals in frequency domain
L_1 = size_audio_samples;
Audio_freq = fft(audio_samples);
Audio_freq_norm = abs(Audio_freq / L_1);
Audio_freq_norm_one = Audio_freq_norm(1:L_1/2 + 1);
Audio_freq_norm_one(2: end-1) = 2 * Audio_freq_norm_one(2:end-1);

L_2 = samples_per_bit * number_of_bits;
X_freq = fft(X);
X_freq_norm = abs(X_freq / L_2);
X_freq_norm_one = X_freq_norm(1: L_2/2 +1);
X_freq_norm_one(2 : end-1) = 2* X_freq_norm_one(2:end-1);

f_1 = Fs*(0 : (L_1/2))/L_1;
f_2 = sampling_rate * (0 : (L_2/2))/L_2;

figure(2);
subplot(2,1,1);
plot(f_1, Audio_freq_norm_one);
title("Single-Sided Amplitude Spectrum of the Original Audio Stream");
xlabel("f(Hz)");
ylabel("|P1(f)|");

subplot(2,1,2);
plot(f_2 , X_freq_norm_one);
title("Single-Sided Amplitude spectrum of X(t)");
xlabel("f(Hz)");
ylabel("|P1(f)|");
xlim([0,150000]);

• In technical English if we say a signal is "modulated" then we mean that we're applying continuous "analog" modulation. So a "phase modulated signal" would be one where we shift the phase of the carrier by the amplitude of the signal, without encoding things into digital. If we're sending digital signals, we say the signal is "keyed" (because a telegraph sender is called a "key"). What you are sending is binary phase-shift keying. You may wish to edit your question for clarity. Commented Mar 10 at 18:07

It appears the OP is attempting to do Binary Phase Shift Keying modulation specifically, without any pulse shaping (so transmit a carrier in phase for a binary bit value = 1, and transmit 180 degrees out of phase for a binary bit value = 0.

For random data, and with no further pulse shaping (rectangular pulses), the frequency spectrum will have an envelope of a Sinc function (power as Sinc squared) with the first nulls spaced at $$1/T_s$$ from the carrier, where $$T_s$$ is the duration of a symbol (which for BPSK is the bit duration). In the OP's case, $$1/T_s = 48000$$ and the spectrum would appear as follows centered on any carrier frequency (shifting zero below to any carrier):

The spectral occupancy is quite large in this case, thus to actually implement with a real carrier frequency, a very high carrier would be necessary to not be impacted by distortion from aliasing. For this reason pulse shaping is often employed for actual BPSK which limits the real passband spectrum to nearly $$\pm 1/(2T_s)$$.

This is not the spectrum by the OP, so I assume there is a flaw in the code or I am misunderstanding the OP's intent. When simulating modulated waveforms, there is no need to simulate actual sinusoidal carriers, given the spectrum would be the same regardless of carrier frequency. Best practice is to use a carrier frequency of 0 (DC), as it minimizes the processing required. This is the baseband equivalent waveform, and generally for arbitrary waveforms would be complex. BPSK is an all real modulation, which simplified this example further to be done with an all real baseband waveform.

The MATLAB code I used is as follows, using random binary data to emulate the OP's audio data stream:

Ts = 1/48e3;
nsamps = 2^14;
upsample = 10;
fs = upsample/Ts;
% generate random data
data = rand(1, nsamps) < 0.5;
% upsample and map to bpsk symbols
bpsk = zeros(1, nsamps * upsample);
bpsk(1:upsample:end) = (2 * data) - 1;
bpsk = conv(bpsk, ones(1,upsample));
bpsk = bpsk(1:end - upsample + 1);
fout = fft(bpsk)/ (upsample * nsamps);
% create frequency axis:
fftfreq = [0: (upsample * nsamps) - 1]  / (nsamps * Ts) - fs / 2;
figure()
plot(fftfreq/ 1e3, 20*log10(fftshift(abs(fout))))


It looks like you're encoding raw audio into signed-magnitude form and then using binary-shift keying.

Take Note: what you are effectively doing in your modulation code is taking a sine wave (your carrier) and multiplying it by 1 where your data is 1, and -1 where your data is 0. I will be writing the rest of this answer as if that is what you are actually doing, because it fits the math better.

I will be calling this binary signal that is either +1 or -1 your baseband signal.

The spectrum that you're getting out indicates that your binary signal has a high degree of correlation every 8th sample. Either you have some bit positions that tend to take on the same value, or you have bits that tend to be the same as the corresponding bits in surrounding samples, or both.

If you are taking musical or voice recordings that tend to sound good when you play them back, then the samples are going to be heavily biased toward an amplitude of 0, with excursions close to 1 being rare. Because your encoding is sign-magnitude, this means that your encoded binary words will have a probability distribution where the sign bit tends to have even odds of being 1 or 0, the least significant bits tend to have even odds of being 1 or 0, but the more significant magnitude bits have a higher probability of being zero. This means that, on average, your baseband signal is mostly zero-ish, but with negative-going peaks with a period of once every 8 bits.

Even if you are putting in sound that is uniformly distributed over the existing magnitude, the fact that you have strong peaks in the spectrum at well below your 6kHz sampling rate means that your sign bits, and the most significant magnitude bits, will be highly correlated with bits 8 bits away, and 16 bits away, etc., with the correlation dropping off as you get further away from any given bit.

The result of this will be an autocorrelation function that has peaks at $$0,\pm 8,\pm 16, \cdots$$ bit intervals -- i.e., intervals of $$\frac 8 {\mathrm{48kHz}} = \frac 1 {\mathrm{8kHz}}$$.

So your baseband signal has peaks in its autocorrelation function at the 8kHz sampling rate. This means that it's power spectral density will have peaks at $$\mathrm{0, \pm 8kHz, \pm 16kHz, \cdots}$$.

When you take your baseband signal and modulate it with your 48kHz signal, the effect in the frequency domain is to take its spectrum and translate it twice: once centered around +48kHz and once centered around -48kHz.

This (or at least the positive frequency half) is what you are seeing in your frequency-domain plot of your modulated signal.