-
Notifications
You must be signed in to change notification settings - Fork 4
/
paramOFDM.m
66 lines (60 loc) · 1.8 KB
/
paramOFDM.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
function Param = paramOFDM(mod, numOfSym, N, D, OV, CP)
Param.N = N;
Param.D = D;
Param.OV = OV;
Param.CP = CP;
Param.S = N;
Param.Offset = 0;
if (D == N)
Param.CarrierIndexes = [1:Param.N]';
else
Param.CarrierIndexes = [2:Param.D/2+1,Param.N-Param.D/2+1:Param.N]';
end
switch mod
case 'BPSK'
Param.M = 1;
Param.mapper = comm.BPSKModulator;
Param.demapper = comm.BPSKDemodulator;
case 'QPSK'
Param.M = 2;
Param.mapper = comm.QPSKModulator('BitInput', true);
Param.demapper = comm.QPSKDemodulator('BitOutput', true);
case '4QAM'
Param.M = 2;
case '16QAM'
Param.M = 4;
case '64QAM'
Param.M = 6;
end
switch mod
case '4QAM'
Param.mapper = comm.RectangularQAMModulator(...
'ModulationOrder', 2^Param.M, ...
'BitInput', true, ...
'NormalizationMethod', 'Average power');
Param.demapper = comm.RectangularQAMDemodulator(...
'ModulationOrder', 2^Param.M, ...
'BitOutput', true, ...
'NormalizationMethod', 'Average power');
case '16QAM'
Param.mapper = comm.RectangularQAMModulator(...
'ModulationOrder', 2^Param.M, ...
'BitInput', true, ...
'NormalizationMethod', 'Average power');
Param.demapper = comm.RectangularQAMDemodulator(...
'ModulationOrder', 2^Param.M, ...
'BitOutput', true, ...
'NormalizationMethod', 'Average power');
case '64QAM'
Param.mapper = comm.RectangularQAMModulator(...
'ModulationOrder', 2^Param.M, ...
'BitInput', true, ...
'NormalizationMethod', 'Average power');
Param.demapper = comm.RectangularQAMDemodulator(...
'ModulationOrder', 2^Param.M, ...
'BitOutput', true, ...
'NormalizationMethod', 'Average power');
end
Param.numOfSym = numOfSym;
Param.numOfBits = D*Param.M*numOfSym;
end