-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathTransmitter.m
41 lines (29 loc) · 1015 Bytes
/
Transmitter.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
%% Transmitter of the OFDM system
function [data_transmit, NoCarriers] = Transmitter (data, NoPilots, trellis)
% Convolutionally encoding data
codedata = convenc(data, trellis);
%% Interleaving coded data
QAMbit = 4;
% 16-QAM: 2^4=16
matrix = reshape (codedata, size(codedata, 2)/QAMbit, QAMbit); % codedata is a column vector
intlvddata = matintrlv(matrix', 2, QAMbit/2)'; % Interleave the coded data
intlvddata = intlvddata';
% Binary to decimal conversion
dec = bi2de(intlvddata','left-msb');
%% 16-QAM Modulation/16-PSK Modulation
y = qammod(dec,16);
% scatterplot(y)
% hModulator = comm.PSKModulator(16,'BitInput',true);
%
% hModulator.PhaseOffset = pi/16; % Change the phase offset to pi/16
%
% y=step(hModulator,dec);
%
% constellation (y);
% Pilot insertion
pilt_data = PilotInsertion(y,NoPilots);
% IFFT
NoCarriers = length (pilt_data);
ifft_sig = ifft(pilt_data', NoCarriers);
% Adding Cyclic Extension
data_transmit = CyclicPrefixAdd(ifft_sig);