0% found this document useful (0 votes)
32 views19 pages

5G-Compliant Waveform Generation and Testing Complete Viva Voce Preparation Guide Lab Practical: Subject: Platform

Uploaded by

aravindh007.n
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views19 pages

5G-Compliant Waveform Generation and Testing Complete Viva Voce Preparation Guide Lab Practical: Subject: Platform

Uploaded by

aravindh007.n
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

5G-COMPLIANT WAVEFORM GENERATION AND TESTING

Complete Viva Voce Preparation Guide

Lab Practical: 5G QPSK Modulation Simulation Subject: Digital Communication / Wireless


Communication Platform: MATLAB

TABLE OF CONTENTS

1. MATLAB Code (Corrected & Complete)

2. Line-by-Line Code Explanation

3. Viva Voce Questions & Answers (47 Questions)

4. Common Question Patterns

5. What Examiners Typically Ask

6. Quick Reference Guide

7. Sample Viva Dialogue

SECTION 1: COMPLETE MATLAB CODE

clc;

clear all;

close all;

% Parameters

carrierFrequency = 3.5e9; % Carrier frequency in Hz (e.g., 3.5 GHz for sub-6GHz 5G)

sampleRate = 30.72e6; % Sample rate in Hz

numSamples = 1024; % Number of samples in the waveform

snr = 20; % Signal-to-noise ratio in dB

% Generate a simple 5G waveform (QPSK modulation)

data = randi([0, 1], 2, numSamples); % Generate random bits for QPSK modulation

qpskSymbols = 2 * data - 1; % Map bits to QPSK symbols (-1, 1)


% Create a time vector

time = (0:numSamples - 1) / sampleRate;

% Modulate the QPSK symbols

qpskSignal = qpskSymbols(1, :) + 1j * qpskSymbols(2, :);

% Generate the carrier signal

carrierSignal = exp(1j * 2 * pi * carrierFrequency * time);

% Generate the transmitted signal

transmittedSignal = qpskSignal .* carrierSignal;

% Add noise to the transmitted signal (manual AWGN implementation)

signalPower = mean(abs(transmittedSignal).^2); % Calculate signal power

noisePower = signalPower / (10^(snr/10)); % Calculate noise power from SNR

noise = sqrt(noisePower/2) * (randn(size(transmittedSignal)) +


1j*randn(size(transmittedSignal)));

noisySignal = transmittedSignal + noise;

% Receiver

receivedSignal = noisySignal .* conj(carrierSignal); % Proper demodulation

% Demodulate the received signal - extract I and Q components

demodulatedI = real(receivedSignal) > 0;

demodulatedQ = imag(receivedSignal) > 0;

decodedData = [demodulatedI; demodulatedQ];


% Calculate Bit Error Rate (BER)

bitErrors = sum(sum(data ~= decodedData));

totalBits = numel(data);

ber = bitErrors / totalBits;

fprintf('Bit Error Rate (BER): %.4f%%\n', ber * 100);

fprintf('Total Errors: %d out of %d bits\n', bitErrors, totalBits);

% Plot the results - matching the original layout

figure('Position', [100, 100, 800, 700]);

% Plot 1: Transmitted Signal (I Component)

subplot(3, 1, 1);

plot(time, real(transmittedSignal), 'b', 'LineWidth', 0.5);

title('Transmitted Signal (I Component)', 'FontSize', 11, 'FontWeight', 'bold');

xlabel('Time (s)', 'FontSize', 10);

ylabel('Amplitude', 'FontSize', 10);

ylim([-2.5 2.5]);

grid off;

box on;

% Plot 2: Received Signal with Noise

subplot(3, 1, 2);

plot(time, real(noisySignal), 'b', 'LineWidth', 0.5);

title('Received Signal with Noise', 'FontSize', 11, 'FontWeight', 'bold');

xlabel('Time (s)', 'FontSize', 10);

ylabel('Amplitude', 'FontSize', 10);

ylim([-2.5 2.5]);
grid off;

box on;

% Plot 3: Transmitted and Decoded Data

subplot(3, 1, 3);

% Flatten data for plotting

transmittedFlat = data(:);

decodedFlat = decodedData(:);

sampleIndices = 1:length(transmittedFlat);

% Create filled areas for transmitted and decoded data

hold on;

for i = 1:length(transmittedFlat)

if transmittedFlat(i) == 1

fill([i-0.5, i+0.5, i+0.5, i-0.5], [0, 0, 1, 1], 'b', 'EdgeColor', 'none');

end

if decodedFlat(i) == 1

fill([i-0.5, i+0.5, i+0.5, i-0.5], [0, 0, 1, 1], 'r', 'EdgeColor', 'none', 'FaceAlpha', 0.5);

end

end

hold off;

title('Transmitted and Decoded Data', 'FontSize', 11, 'FontWeight', 'bold');

xlabel('Sample Index', 'FontSize', 10);

ylabel('Bit Value', 'FontSize', 10);

ylim([0 1.2]);

xlim([0 length(transmittedFlat)]);

legend('Transmitted Data', 'Decoded Data', 'Location', 'northeast');


grid off;

box on;

SECTION 2: LINE-BY-LINE CODE EXPLANATION

Initialization Section

Line 1: clc;

• Purpose: Clears the command window

• Function: Removes all previous text output

• Why needed: Provides clean display for new program results

• Effect: Visual only - does not affect variables or workspace

Line 2: clear all;

• Purpose: Removes all variables from workspace memory

• Function: Deletes every variable currently stored

• Why needed: Prevents interference from previous program executions

• Effect: Frees RAM and ensures fresh start

Line 3: close all;

• Purpose: Closes all open figure windows

• Function: Terminates all active plot windows

• Why needed: Prevents accumulation of multiple windows

• Effect: Releases graphics memory resources

Parameter Definition Section

Line 5: carrierFrequency = 3.5e9;

• Value: 3.5 × 10⁹ Hz = 3.5 GHz

• Purpose: Defines the RF center frequency for transmission

• 5G Context: Standard mid-band 5G NR frequency (n78 band: 3.3-3.8 GHz)

• Physical meaning: The "radio wave" that carries information through air

• Why this value:

o Better propagation than mmWave (24+ GHz)


o Higher capacity than low-band (<1 GHz)

o Widely deployed globally

o Good balance of coverage (~500m radius) and speed

• Wavelength: λ = c/f = 3×10⁸/3.5×10⁹ = 8.57 cm

Line 6: sampleRate = 30.72e6;

• Value: 30.72 × 10⁶ Hz = 30.72 MHz = 30,720,000 samples/second

• Purpose: Defines sampling frequency for digital signal processing

• 5G Standard: Official sampling rate for 100 MHz bandwidth in 5G NR

• Nyquist Requirement: Must be ≥ 2× highest frequency component

• Time resolution: Interval between samples = 1/30.72MHz = 32.55 nanoseconds

• Why this value:

o Based on 5G NR specifications

o Calculated as: FFT size × subcarrier spacing

o Example: 2048 × 15 kHz = 30.72 MHz

Line 7: numSamples = 1024;

• Value: 1024 samples

• Purpose: Total length of the transmitted waveform

• Why 1024: Power of 2 (2¹⁰), efficient for FFT operations

• Time duration: T = N/fs = 1024/30.72×10⁶ ≈ 33.3 microseconds

• Total bits transmitted: 1024 samples × 2 bits/symbol = 2048 bits

• Trade-off: More samples = longer simulation but better statistics

Line 8: snr = 20;

• Value: 20 decibels (dB)

• Purpose: Defines Signal-to-Noise Ratio for channel quality

• Meaning: SNR(dB) = 10 log₁₀(Psignal/Pnoise)

• Linear equivalent: 20 dB = 10^(20/10) = 100

o Signal power is 100 times larger than noise power

• Channel quality:
o < 10 dB: Poor (high error rate)

o 10-20 dB: Moderate (QPSK works well)

o 20 dB: Good (can use higher modulation)

• Expected BER: At 20 dB, QPSK typically achieves BER < 10⁻⁴

• 5G context: Real networks experience 5-30 dB depending on distance

Data Generation Section

Line 11: data = randi([0, 1], 2, numSamples);

• Function: randi = random integer generator

• Arguments:

o [0, 1]: Range - generates only 0 or 1 (binary)

o 2: Number of rows

o numSamples: Number of columns (1024)

• Output: 2×1024 matrix of random binary values

• Structure:

o Row 1: I (In-phase) component bits

o Row 2: Q (Quadrature) component bits

• Why 2 rows: QPSK requires 2 bits per symbol

• Example output:

• data = [0 1 1 0 1 0 ... ← I bits (row 1) 1 0 1 1 0 1 ... ← Q bits (row 2)

• Purpose: Simulates source data to be transmitted

Line 12: qpskSymbols = 2 * data - 1;

• Mathematical operation: Linear transformation

• Mapping rule:

o If data = 0: 2(0) - 1 = -1

o If data = 1: 2(1) - 1 = +1

• Result: Converts {0, 1} → {-1, +1}

• Why needed:

o Modulation requires bipolar signals (positive and negative)


o Creates symmetric constellation around origin

o Standard in digital communications

• Example:

• Before: [0 1 1 0] → After: [-1 +1 +1 -1]

• Purpose: Prepares data for QPSK modulation

Time Vector Creation

Line 15: time = (0:numSamples - 1) / sampleRate;

• Operation breakdown:

1. (0:numSamples - 1) creates [0, 1, 2, 3, ..., 1023]

2. Divide each element by sampleRate (30.72×10⁶)

• Result: Time values in seconds

• Range: 0 to (1023/30.72×10⁶) = 0 to 33.3 microseconds

• Step size: Δt = 1/sampleRate = 32.55 nanoseconds

• Purpose:

o Provides time axis for signal generation

o Used in carrier wave generation

o Enables time-domain plotting

• Example values:

o time(1) = 0 seconds

o time(2) = 3.255×10⁻⁸ seconds

o time(1024) = 3.33×10⁻⁵ seconds

QPSK Modulation

Line 18: qpskSignal = qpskSymbols(1, :) + 1j * qpskSymbols(2, :);

• Component extraction:

o qpskSymbols(1, :): First row = I component (all columns)

o qpskSymbols(2, :): Second row = Q component (all columns)

• 1j: MATLAB's imaginary unit (√-1)

• Operation: Creates complex numbers in form I + jQ


• QPSK Constellation: 4 possible symbols

o (+1, +1) = +1 + j(+1) → Bits: 11

o (+1, -1) = +1 + j(-1) → Bits: 10

o (-1, +1) = -1 + j(+1) → Bits: 01

o (-1, -1) = -1 + j(-1) → Bits: 00

• Mathematical representation: s(t) = I(t) + jQ(t)

• Why complex numbers:

o Compact representation of amplitude and phase

o Efficient mathematical operations

o Standard in RF/communication systems

• Physical meaning:

o Real part (I): Modulates cos(ωt)

o Imaginary part (Q): Modulates sin(ωt)

Carrier Signal Generation

Line 21: carrierSignal = exp(1j * 2 * pi * carrierFrequency * time);

• Mathematical formula: e^(j2πfct)

• Euler's identity: e^(jθ) = cos(θ) + j·sin(θ)

• Expanded form: cos(2πfct) + j·sin(2πfct)

• Parameters:

o 2 * pi: Converts Hz to radians/second (ω = 2πf)

o carrierFrequency: fc = 3.5×10⁹ Hz

o time: Time vector

• Result: Complex sinusoid oscillating at 3.5 GHz

• Purpose: High-frequency carrier wave for RF transmission

• Why exponential form:

o Simpler than trig functions in calculations

o Multiplication is easier than trig identities

o Standard in communication theory


• Physical interpretation:

o Rotating phasor at 3.5 GHz

o Real part: cos wave

o Imaginary part: sin wave (90° phase shift)

Signal Transmission (Upconversion)

Line 24: transmittedSignal = qpskSignal .* carrierSignal;

• Operator .*: Element-wise multiplication

• Mathematical operation: (I + jQ) × e^(j2πfct)

• Process name: Upconversion or frequency translation

• Effect: Shifts baseband signal to carrier frequency

• Frequency domain:

o Before: Signal centered at 0 Hz (baseband)

o After: Signal centered at 3.5 GHz (RF)

• Why needed:

o Baseband signals (~0 Hz) cannot propagate through air

o Antennas work efficiently at RF frequencies

o Enables wireless transmission

o Allows multiple users on different carriers (FDMA)

• Antenna consideration:

o Efficient antenna length ≈ λ/4

o At 100 Hz: λ/4 = 750 km (impossible!)

o At 3.5 GHz: λ/4 = 2.1 cm (practical!)

• Result: RF signal ready for transmission

Channel Noise Addition (AWGN)

Line 27: signalPower = mean(abs(transmittedSignal).^2);

• abs(...): Magnitude of complex signal = √(I² + Q²)

• .^2: Square each element (element-wise power)

• mean(...): Average over all samples


• Formula: Pavg = (1/N) Σ|s[n]|²

• Purpose: Calculate average transmitted power

• Why absolute value: Power of complex signal uses magnitude

• Units: Normalized watts (dimensionless in simulation)

• Example: If |s| = 1.414 (for QPSK), then Power ≈ 2

Line 28: noisePower = signalPower / (10^(snr/10));

• SNR definition: SNR(dB) = 10 log₁₀(Psignal/Pnoise)

• Rearranging: Pnoise = Psignal / 10^(SNR(dB)/10)

• Calculation for SNR = 20 dB:

o 10^(20/10) = 10² = 100

o Pnoise = Psignal/100

• Meaning: Noise power is 100× smaller than signal power

• Purpose: Determine correct noise level for desired SNR

• Result: Ensures specified channel quality

Line 29: noise = sqrt(noisePower/2) * (randn(size(transmittedSignal)) +


1j*randn(size(transmittedSignal)));

• Breaking down the operation:

1. randn(size(transmittedSignal)):

▪ Generates Gaussian random numbers

▪ Mean = 0, Standard deviation = 1

▪ Same size as transmitted signal (1×1024)

2. Two randn calls:

▪ First: Real part (I component noise)

▪ Second: Imaginary part (Q component noise)

▪ Creates complex noise: nI + j·nQ

3. sqrt(noisePower/2):

▪ Why divide by 2: Split power equally between I and Q

▪ Why square root: Power ∝ amplitude², so amplitude = √power


▪ Scales noise to correct power level

• Statistical properties:

o Distribution: Gaussian (normal)

o Mean: μ = 0 (centered)

o Variance: σ² = noisePower/2 per component

o Total power: σ²I + σ²Q = noisePower

• AWGN characteristics:

o Additive: Added to signal

o White: Equal power at all frequencies

o Gaussian: Amplitude follows bell curve

o Noise: Random, unpredictable

• Why Gaussian:

o Models thermal noise in electronics

o Central Limit Theorem (many random sources combine)

o Mathematically tractable

o Worst-case scenario for analysis

Line 30: noisySignal = transmittedSignal + noise;

• Operation: Simple element-wise addition

• Formula: r(t) = s(t) + n(t)

• Purpose: Simulates the wireless channel

• Physical meaning: What the receiver antenna captures

• Channel model: AWGN (simplest wireless channel)

• Real channels also have:

o Path loss (signal weakens with distance)

o Fading (multipath interference)

o Interference (other users/devices)

o Doppler shift (movement)

• This simulation: Only considers noise (baseline case)


Receiver Section

Line 33: receivedSignal = noisySignal .* conj(carrierSignal);

• conj(carrierSignal): Complex conjugate

o Original: e^(j2πfct) = cos(2πfct) + j·sin(2πfct)

o Conjugate: e^(-j2πfct) = cos(2πfct) - j·sin(2πfct)

• Operation: Coherent demodulation (downconversion)

• Mathematical principle:

o Transmitted: s(t)·e^(j2πfct)

o Received: [s(t)·e^(j2πfct) + n(t)]

o Multiply by: e^(-j2πfct)

o Result: s(t)·e^(j2πfct)·e^(-j2πfct) = s(t)·e^(j0) = s(t)

• Effect: Shifts signal from 3.5 GHz back to baseband (0 Hz)

• Technical term: "Synchronous demodulation" or "coherent detection"

• Requirements:

o Receiver must know exact carrier frequency

o Phase synchronization needed

o Called "coherent" because phases must match

• Why multiply, not divide:

o Mathematically equivalent: 1/e^(jθ) = e^(-jθ)

o Multiplication is simpler and more stable

Symbol Decision (Demodulation)

Line 36: demodulatedI = real(receivedSignal) > 0;

• real(...): Extracts in-phase (I) component (discards imaginary part)

• > 0: Threshold comparison operator

• Decision logic:

o If I component > 0 → bit = 1 (logical true)

o If I component < 0 → bit = 0 (logical false)

• Output: Logical array (1024 elements of true/false)


• Why threshold at 0:

o QPSK symbols are at ±1

o Zero is optimal decision boundary

o Minimizes probability of error for symmetric constellation

• Technical term: "Hard decision" (not soft decision with probabilities)

Line 37: demodulatedQ = imag(receivedSignal) > 0;

• imag(...): Extracts quadrature (Q) component

• Same logic: Threshold detection at zero

• Purpose: Recovers Q component bits

• Combined with I: Gives complete QPSK symbol decisions

Line 38: decodedData = [demodulatedI; demodulatedQ];

• [...; ...]: Vertical concatenation (semicolon stacks rows)

• Result: 2×1024 matrix

o Row 1: Decoded I bits

o Row 2: Decoded Q bits

• Format: Matches original data structure for comparison

• Purpose: Reconstructed data ready for error checking

Bit Error Rate (BER) Calculation

Line 41: bitErrors = sum(sum(data ~= decodedData));

• data ~= decodedData:

o Element-wise comparison

o Returns logical matrix (true where bits differ, false where same)

o Example: [1 0 1] ~= [1 1 1] returns [false true false]

• Inner sum(...):

o Sums each column

o Counts errors per time sample (I and Q errors)

• Outer sum(...):

o Sums all columns


o Total number of bit errors across entire transmission

• Result: Single number = total incorrect bits

Line 42: totalBits = numel(data);

• numel(...): Number of elements in array

• Calculation: 2 rows × 1024 columns = 2048 total bits

• Purpose: Denominator for BER calculation

Line 43: ber = bitErrors / totalBits;

• Formula: BER = (Number of errors) / (Total bits sent)

• Range: 0 (perfect) to 1 (complete failure)

• Interpretation:

o BER = 0.001 means 1 error per 1000 bits (0.1%)

o BER = 10⁻⁶ means 1 error per million bits

• Quality assessment:

o < 10⁻⁶: Excellent (high-quality data)

o 10⁻³ to 10⁻⁶: Acceptable (voice, video)

o 10⁻³: Poor (needs error correction)

• 5G target: Typically < 10⁻⁵ for reliable service

Lines 45-46: fprintf statements

• Purpose: Display results in command window

• Format specifiers:

o %.4f: Floating point with 4 decimal places

o %d: Integer (whole number)

• Output example:

• Bit Error Rate (BER): 0.0488%Total Errors: 1 out of 2048 bits

Plotting Section

Line 49: figure('Position', [100, 100, 800, 700]);

• figure: Creates new figure window

• 'Position' property: [left, bottom, width, height] in pixels


• Values:

o Left edge at x=100 pixels from screen left

o Bottom edge at y=100 pixels from screen bottom

o Width = 800 pixels

o Height = 700 pixels

• Purpose: Creates appropriately sized window for three stacked plots

Plot 1: Transmitted Signal

Line 52: subplot(3, 1, 1);

• Format: subplot(rows, columns, index)

• Arguments: 3 rows, 1 column, activate position 1 (top)

• Effect: Divides figure into 3 horizontal sections, selects top section

Line 53: plot(time, real(transmittedSignal), 'b', 'LineWidth', 0.5);

• Arguments:

o time: X-axis data (horizontal axis)

o real(transmittedSignal): Y-axis data (I component)

o 'b': Blue color

o 'LineWidth', 0.5**: Thin line (default is 0.5, can go up to 10+)

• Purpose: Visualize transmitted waveform in time domain

• What you see: Rapidly oscillating signal at 3.5 GHz

Line 54: title('Transmitted Signal (I Component)', 'FontSize', 11, 'FontWeight', 'bold');

• Purpose: Adds descriptive title above plot

• Properties:

o Font size: 11 points

o Bold text for emphasis

Lines 55-56: X and Y labels

• xlabel('Time (s)', 'FontSize', 10);: Labels horizontal axis

• ylabel('Amplitude', 'FontSize', 10);: Labels vertical axis

• Units: Time in seconds, amplitude normalized


Line 57: ylim([-2.5 2.5]);

• Purpose: Sets Y-axis display range

• Range: -2.5 to +2.5

• Why: QPSK symbols at ±1, adds margin for clarity

Lines 58-59: Grid and box

• grid off;: Removes background grid lines

• box on;: Draws border around plot area

Plot 2: Received Signal (Lines 62-69)

• Similar structure to Plot 1

• Key difference: Plots real(noisySignal)

• Shows: Same signal but with added noise

• Comparison: Can visually see noise effect

Plot 3: Data Comparison (Lines 72-94)

Lines 77-78: Data preparation

• transmittedFlat = data(:);: Reshapes 2×1024 to 2048×1 vector

• decodedFlat = decodedData(:);: Same for decoded data

• Purpose: Convert matrix to single column for sequential plotting

Lines 82-89: Filled rectangle loop

for i = 1:length(transmittedFlat)

if transmittedFlat(i) == 1

fill([i-0.5, i+0.5, i+0.5, i-0.5], [0, 0, 1, 1], 'b', 'EdgeColor', 'none');

end

if decodedFlat(i) == 1

fill([i-0.5, i+0.5, i+0.5, i-0.5], [0, 0, 1, 1], 'r', 'EdgeColor', 'none', 'FaceAlpha', 0.5);

end

end

• Loop: Iterates through each bit

• fill function: Creates filled polygon


o X coordinates: [i-0.5, i+0.5, i+0.5, i-0.5] (rectangle from i-0.5 to i+0.5)

o Y coordinates: [0, 0, 1, 1] (height from 0 to 1)

o Color: 'b' (blue) for transmitted, 'r' (red) for decoded

o 'EdgeColor', 'none': No outline

o 'FaceAlpha', 0.5: 50% transparency for decoded (shows overlap)

• Logic:

o If bit = 1: Draw filled bar

o If bit = 0: Leave empty (white space)

• Visual result:

o Blue bars: Transmitted 1s

o Red bars: Decoded 1s

o Where blue and red overlap (purple): Correctly decoded 1s

o Blue only: Should have been decoded as 1 but wasn't (error)

o Red only: Incorrectly decoded as 1 (error)

Line 95: legend('Transmitted Data', 'Decoded Data', 'Location', 'northeast');

• Purpose: Creates legend box identifying colors

• Location: Top-right corner of plot

• Helps: User understand what each color represents

SECTION 3: VIVA VOCE QUESTIONS & ANSWERS

BASIC CONCEPTS

Q1. What is 5G, and how is it different from 4G?

Answer: 5G (Fifth Generation) is the latest wireless communication standard with significant
improvements:

• Speed: Up to 20 Gbps peak (vs 1 Gbps in 4G)

• Latency: 1 ms (vs 30-50 ms in 4G) - critical for real-time applications

• Frequency bands: Uses sub-6 GHz AND mmWave (24-100 GHz)

• Technology: Massive MIMO, beamforming, advanced modulation (up to 256-QAM)


• **

You might also like