It’s the first post of my digital communication fundamental series. I have started reading a book called “SDR 4 Engineers, Travis F” as the first step of my thesis. Actually, students can access the original codes shared in the book via GitHub repo. Here my purpose is just chunking the whole chapter into small pieces and reinforce my knowledge/experiment that new for me. I will be trying to share something here as soon as I have enough time.

The first example is about modulation basics, there will be a MATLAB code showing modulation types for digital communication.  Let’s look at the explanation of theory;

Communication systems convey information by manipulating the physical properties of an electromagnetic signal before it is broadcasted across a medium. Signal properties such as the amplitude, phase, and/or frequency are manipulated over time in such a manner that the receiver can interpret the message being conveyed by the transmitter. These electromagnetic broadcasts often use sine wave signals, which makes them relatively straightforward to manipulate for the purposes of conveying information.

In the MATLAB script below, we generate three sine wave-based transmissions, where information is embedded in them via their amplitude levels (amplitude shift keying), phase characteristics (phase shift keying), or frequency values (frequency shift keying).

Here are some outputs from the code:

Here is the code:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Sending binary data via sinusoidal signal manipulation
% Parameters
sig_len = 1000; % Signal length (in samples)
sampl_per_bin = 100; % Samples per binary representation
bin_data_len = sig_len/sampl_per_bin; %length of binary stream is a multiple of signal length
bin_data = round(rand(1,bin_data_len));
sig_carrier_base = sin(2*pi*(0:(1/sampl_per_bin):(1-(1/sampl_per_bin)))); % Baseline carrier
sig_carrier_freq = sin(2*2*pi*(0:(1/sampl_per_bin):(1-(1/sampl_per_bin)))); % Double frequency
sig_carrier_phase = sin(2*pi*(0:(1/sampl_per_bin):(1-(1/sampl_per_bin)))+(pi/4)); % Phase shifted by 45 degrees
% Modulate sinusoidal carrier via amplitude, phase, and frequency
% manipulations
sig_bin = []; % Binary waveform
sig_ask = []; % Amplitude modulated
sig_psk = []; % Phase modulated
sig_fsk = []; % Frequency modulated
for ind = 1:1:bin_data_len
if (bin_data(ind)==1)
sig_bin = [sig_bin ones(1,sampl_per_bin)];
sig_ask = [sig_ask sig_carrier_base];
sig_psk = [sig_psk sig_carrier_base];
sig_fsk = [sig_fsk sig_carrier_base];
else
sig_bin = [sig_bin zeros(1,sampl_per_bin)];
sig_ask = [sig_ask 0.5*sig_carrier_base];
sig_psk = [sig_psk sig_carrier_phase];
sig_fsk = [sig_fsk sig_carrier_freq];
end
end
figure;
subplot(4,1,1);
plot(sig_bin);
title("Binary Signal");
subplot(4,1,2);
plot(sig_ask);
title("ASK (Amplitude Shifting) Signal");
subplot(4,1,3);
plot(sig_fsk);
title("FSK (Freq. Shifting) Signal");
subplot(4,1,4);
plot(sig_psk);
title("PSK (Phase Shifting) Signal");

GitHub