0% found this document useful (0 votes)
27 views8 pages

Digital Modulation Techniques Overview

The document covers various digital communication techniques including Binary Digital Modulation using SDR, Baseband DSSS, MIMO Transceiver Design, CDMA Performance Evaluation, and Convolutional Coding with Viterbi Decoding. Each section includes MATLAB code for generating, transmitting, and receiving signals, along with visualizations of the original data, transmitted signals, and recovered data. The techniques demonstrate key concepts in signal processing and communication systems.

Uploaded by

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

Digital Modulation Techniques Overview

The document covers various digital communication techniques including Binary Digital Modulation using SDR, Baseband DSSS, MIMO Transceiver Design, CDMA Performance Evaluation, and Convolutional Coding with Viterbi Decoding. Each section includes MATLAB code for generating, transmitting, and receiving signals, along with visualizations of the original data, transmitted signals, and recovered data. The techniques demonstrate key concepts in signal processing and communication systems.

Uploaded by

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

1.

Generation & Detection of Binary Digital


Modulation using SDR

fs = 1e6; % Sample rate


fc = 100e3; % Carrier frequency
data = randi([0 1], 1, 100); % Reduced to 100 bits for easier visualization
bpskSig = 2*data - 1; % BPSK mapping (0 -> -1, 1 -> 1)

t = (0:length(bpskSig)-1)/fs; % Time vector


carrier = cos(2*pi*fc*t); % Carrier signal

% Transmitter
tx = bpskSig .* carrier; % Modulated signal

% Receiver
rx = tx .* carrier; % Coherent demodulation (mixing)
rxLPF = lowpass(rx, fc, fs); % Low-pass filter to retrieve baseband
received = rxLPF > 0; % Decision device (bit recovery)

% Plotting
figure;
subplot(5,1,1);
stem(data(1:20), 'filled');
title('Original Data (First 20 Bits)');
ylim([-0.5 1.5]);

subplot(5,1,2);
plot(t(1:1000), tx(1:1000));
title('Transmitted BPSK Signal');
xlabel('Time (s)');
ylabel('Amplitude');

subplot(5,1,3);
plot(t(1:1000), rx(1:1000));
title('Received Signal After Mixing');
xlabel('Time (s)');
ylabel('Amplitude');

subplot(5,1,4);
plot(t(1:1000), rxLPF(1:1000));
title('Low-pass Filtered Signal');
xlabel('Time (s)');
ylabel('Amplitude');

subplot(5,1,5);
stem(received(1:20), 'filled');
title('Recovered Data (First 20 Bits)');
ylim([-0.5 1.5]);
2. Spread Spectrum Communication - Baseband
DSSS

% Baseband DSSS with visualization


data = randi([0 1], 1, 10); % Original binary data (10 bits)
chips_per_bit = 10; % Spreading factor
pn_seq = randi([0 1], 1, length(data)*chips_per_bit); % PN sequence

% Data spreading
data_upsampled = repelem(data, chips_per_bit); % Repeat each bit
pn_bipolar = 2*pn_seq - 1; % Convert to bipolar
data_bipolar = 2*data_upsampled - 1;
spread_data = data_bipolar .* pn_bipolar; % Spread signal

% Time vector for plotting


t = 0:1:length(spread_data)-1;
% Plotting
figure;
subplot(3,1,1);
stem(repelem(data, chips_per_bit), 'filled');
title('Original Data (Upsampled)');
xlabel('Chip Index');
ylim([-1.5 1.5]);

subplot(3,1,2);
stem(pn_bipolar, 'filled');
title('PN Sequence (Bipolar)');
xlabel('Chip Index');
ylim([-1.5 1.5]);

subplot(3,1,3);
plot(t, spread_data, 'LineWidth', 1.5);
title('Spread Signal (DSSS Output)');
xlabel('Chip Index');
ylabel('Amplitude');
ylim([-1.5 1.5]);
3.MIMO Transceiver Design (2x2 System)

N = 1000; % Number of symbol pairs to transmit


s = 2*randi([0 1], 2, N) - 1; % BPSK symbols for 2 transmit antennas

% MIMO Channel Matrix (Rayleigh fading)


H = (randn(2,2,N) + 1i*randn(2,2,N)) / sqrt(2);

% Transmit and receive signals


x = zeros(2, N); % Transmitted
y = zeros(2, N); % Received
r = zeros(2, N); % Detected

for i = 1:N
x(:,i) = s(:,i);
y(:,i) = H(:,:,i) * x(:,i); % Channel effect
r(:,i) = pinv(H(:,:,i)) * y(:,i); % Zero-forcing detection
end

% Plotting Transmitted vs Received Symbols


figure;

subplot(2,1,1);
scatter(real(x(:)), imag(x(:)), 20, 'b', 'filled');
title('Transmitted BPSK Symbols');
xlabel('In-Phase');
ylabel('Quadrature');
grid on;
axis([-2 2 -2 2]); % Zoomed axis for better visibility

subplot(2,1,2);
scatter(real(r(:)), imag(r(:)), 20, 'r', 'filled');
title('Detected Symbols after MIMO Channel and Equalization');
xlabel('In-Phase');
ylabel('Quadrature');
grid on;
axis([-2 2 -2 2]);
4.CDMA Performance Evaluation

% CDMA using Walsh codes with visualization

users = 4;
chips = 8;

% Generate random data for all users


data = randi([0 1], users, 1); % Binary data
bipolar_data = 2*data - 1; % Convert to bipolar

% Generate Walsh codes (Hadamard matrix)


walsh = hadamard(chips);

% Each column of Walsh is a spreading code for each user


user_codes = walsh(:,1:users);
% Spread (encode) data
encoded = user_codes * bipolar_data; % Spread signal (chips x 1)

% Add Gaussian noise


noise = 0.5*randn(chips, 1);
rx = encoded + noise;

% Despread (decode) signal


decoded = user_codes' * rx / chips; % Normalized by chips

% Plotting
figure;

subplot(4,1,1);
stem(data, 'filled');
title('Original User Data');
ylim([-0.5 1.5]);

subplot(4,1,2);
plot(encoded, 'b-o');
title('Spread (Encoded) Signal');
xlabel('Chip Index');
ylabel('Amplitude');

subplot(4,1,3);
plot(rx, 'r-o');
title('Received Signal (with Noise)');
xlabel('Chip Index');
ylabel('Amplitude');

subplot(4,1,4);
bar(decoded);
title('Decoded User Data Values');
xlabel('User');
ylabel('Amplitude (Before Thresholding)');
grid on;
5.Channel Coder/Decoder - Convolutional Code

% Convolutional Encoding and Viterbi Decoding with Visualization

trellis = poly2trellis(7, [171 133]); % Constraint length 7, generator polynomials


data = randi([0 1], 100, 1); % Random input data (100 bits)

% Convolutional encoding
encoded = convenc(data, trellis); % Encoded sequence (rate 1/2)

% Pass through AWGN channel


noisy = awgn(double(encoded), 5, 'measured'); % Add noise (Eb/N0 = 5 dB)

% Hard decision decoding (threshold at 0.5)


decoded = vitdec(noisy > 0.5, trellis, 34, 'trunc', 'hard');

% Plotting
figure;
subplot(4,1,1);
stem(data(1:30), 'filled');
title('Original Data (First 30 Bits)');
ylim([-0.5 1.5]);

subplot(4,1,2);
stem(encoded(1:60), 'filled');
title('Encoded Data (First 60 Bits)');
ylim([-0.5 1.5]);

subplot(4,1,3);
plot(noisy(1:60), 'r.-');
title('Noisy Encoded Data (First 60 Samples)');
ylabel('Amplitude');

subplot(4,1,4);
stem(decoded(1:30), 'filled');
title('Decoded Data (First 30 Bits)');
ylim([-0.5 1.5]);

You might also like