Mobile Wireless Security Lab
Mobile Wireless Security Lab
% Date: [Date]
%% Define Parameters
protocol = input('Select the protocol to simulate (3G, 4G, 5G): ', 's');
% Common parameters
switch protocol
case '3G'
% 3G-specific Parameters
fprintf('Simulating 3G Protocol...\n');
% Generate Signal
% Plot
figure;
disp('Simulating 3G Protocol...');
disp('Simulation Complete.');
case '4G'
% 4G-specific Parameters
fprintf('Simulating 4G Protocol...\n');
% Plot
figure;
disp('Simulating 4G Protocol...');
disp('Simulation Complete.');
case '5G'
% 5G-specific Parameters
fprintf('Simulating 5G Protocol...\n');
figure;
disp('Simulating 5G Protocol...');
disp('Simulation Complete.');
otherwise
end
fprintf('Simulation Complete.\n');
Simulating 3G Protocol...
Simulating 3G Protocol...
Simulation Complete.
Simulation Complete.
Top Plot: 3G Data Bits
Description: This plot shows the original random binary data (0s and 1s) generated for the
simulation.
Behavior:
o The horizontal axis represents the sample number, while the vertical axis shows the
amplitude of the data bits (normalized between 0 and 1).
Purpose: These data bits serve as the baseband signal before the spreading process.
Bottom Plot: 3G Spread Signal
Description: This plot shows the result of the spreading process, where the data bits are
combined with a spreading code.
Behavior:
o The signal appears more dense and continuous compared to the original data because
each bit is spread over many samples using the spreading factor.
o The horizontal axis (in thousands) represents the total number of samples after
spreading, which is significantly larger than the original data bits due to the spreading
factor.
Purpose: The spreading process is a key feature of CDMA (Code Division Multiple Access) used
in 3G. It spreads the data over a wide bandwidth, increasing robustness against interference and
allowing multiple users to share the same frequency band.
Observations
1. Spreading Process: The spreading factor (e.g., 256 in this simulation) determines the expansion
of the data signal. The number of samples in the spread signal is much larger than in the original
data bits.
2. Signal Integrity: The spreading ensures that the signal can be transmitted securely and
recovered despite noise or interference.
Simulating 4G Protocol...
Simulation Complete.
The plots in your uploaded image show the following:
o This plot represents the magnitude of the OFDM symbols for each subcarrier. The
variation across the subcarriers reflects the modulation and mapping applied during the
OFDM signal generation process.
o This plot displays the time-domain signal after adding the cyclic prefix. It shows how the
transmitted signal appears in the time domain, including the redundancy introduced by
the cyclic prefix.
The simulation looks correct and indicates that your 4G OFDM model is functioning properly. Let me
know if you need any further analysis, enhancements, or explanations about this simulation!
What it Represents:
o This plot shows the amplitude (or magnitude) of the generated OFDM symbols across
the subcarriers.
o Each subcarrier is a distinct frequency within the OFDM spectrum, and it carries one
modulated symbol (e.g., from 16-QAM in this case).
o The variations in amplitude reflect the specific data mapped onto each subcarrier and
the modulation scheme applied (16-QAM).
Key Observations:
o The amplitudes fluctuate because 16-QAM modulates data onto both the real and
imaginary components of each subcarrier.
o These subcarriers are orthogonal to each other (a key feature of OFDM), which prevents
interference between them.
o The smoothness and pattern may vary depending on the data being transmitted.
o This graph provides insight into the frequency domain representation of the OFDM
signal before transmission.
o Any anomalies here could indicate issues with modulation or symbol mapping.
What it Represents:
o This plot shows the time-domain signal after performing the IFFT (inverse Fourier
transform) on the subcarrier data and adding a cyclic prefix.
o The cyclic prefix is a short repetition of the end of the OFDM symbol, added at the
beginning to combat inter-symbol interference (ISI) caused by multipath propagation.
Key Observations:
o The signal appears more random, as it combines contributions from all subcarriers in the
time domain.
o The spikes and fluctuations represent the superposition of the different subcarrier
signals.
o The cyclic prefix introduces a repetitive structure at the start of each symbol, but in this
graph, it's not easily distinguishable since we're viewing continuous samples.
Why It's Important:
o Analyzing it helps ensure that the signal is correctly modulated and prepared for real-
world conditions, such as multipath effects and noise.
The top plot shows the frequency-domain view of the OFDM signal, where each subcarrier
carries a specific amplitude based on the data.
The bottom plot shows the same signal transformed into the time domain, which is ready for
transmission.
The cyclic prefix in the bottom plot is crucial for maintaining the orthogonality of the subcarriers
in the presence of channel delays.
Simulating 5G Protocol...
Simulating 5G Protocol...
Simulation Complete.
Simulation Complete.