I am trying to build a simulation for a 2PPM signal, modulate it at high frequency and then retrieve my baseband signal. Here is my full code (minus the plots) before explaining more.
% ---------Building the Binary Pulse Position Modulated signal :--------%
% Parameters
messageLength = 10; % Number of symbols in the message
Ts = 1; % Symbol period (in seconds)
messageTime = messageLength * Ts; % Message length in seconds
Rs = 1 / Ts; % Symbol rate (in Hz)
A = 1; % Pulse amplitude
Fc = 50; % Carrrier frequency (in Hz)
Fs = 10 * Rs; % Sampling rate (in Hz)*
B = 2 / Ts; % Signal bandwidth (in Hz)
SNR = 50; % Signal-to-Noise-Ratio
% Generate the message vector
message = randi([0, 1], 1, messageLength);
fprintf('Message length: %d\n', length(message));
% Generate the time vector
t = linspace(0, messageLength * Ts, 100 * messageLength);
fprintf("Time vector length : %d\n", length(t));
% Generate PPM waveform
ppmBB = zeros(size(t));
for i = 1:messageLength
if message(i) == 1
% Set the pulse amplitude for symbol '1' in the first half of the symbol duration
ppmBB(t >= (i - 1) * Ts & t < (i - 0.5) * Ts) = A;
else
% Set the pulse amplitude for symbol '0' in the second half of the symbol duration
ppmBB(t >= (i - 0.5) * Ts & t < i * Ts) = A;
end
end
% Add carrier frequency to the PPM signal
carrierWave = cos(2 * pi * Fc * t);
ppmPB = ppmBB .* carrierWave;
% ------------ Additive White Gaussian Noise Channel ------------------%
% We wish to generate a white gaussian noise vector of appropriate strength
% depending on the input Signal-to-Noise-Ratio in the parameters
% Calculate the signal power
signalPowerW = (1 / messageLength) * sum(abs(ppmPB).^2);
signalPowerdB = 10 * log(signalPowerW);
fprintf("PPM passband signal power (in dB) : %d\n", signalPowerdB);
% Convert SNR from dB to linear scale
SNR_linear = 10^(SNR/10);
% Calculate the noise power spectral density in watts per Hertz
N0 = signalPowerW / SNR_linear;
fprintf("Noise power spectral density (in W/Hz) : %d\n", N0);
% Generate the noise vector
n = sqrt(N0/2)*randn(size(ppmPB));
% Received signal
ppmPB_noise = ppmPB + n;
% ------------ Pulse Position Modulated signal receiver ----------------%
% Take the ppm signal back to baseband
carrierWaveReceiver = cos(2 * pi * Fc * t);
ppmBB_noise = ppmPB_noise .* carrierWaveReceiver;
The simulation starts by creating a random vector of 1s ans 0s. The vector is converted into a PPM signal according to the ADS-B specification (not going into detailq about this here) and the signal looks like this :
The second step is to take the baseband signal and multiply it with a carrier wave at frequency Fc. My first issue appears here. In my code I am using Fc = 50 Hz (for testing) and i can see a low frequency amplitude modulation of my signal that is not intended. You can see the passband signal here :
The signal is then passend through a AWGN channel and I think I didnt make mistake on this part. After the AWGN channel the signal is once again multiplied by the carrier wave to retrieve the baseband signal. I still dont understand why but I dont get the baseband signal, you can see it here :
I think the way I create my signal is not correct and I should use sampling but I dont know how to implement it and I dont think it is the main issue in my code. Feel free to criticize my code and help me get this simulation working.
1:


