-
Notifications
You must be signed in to change notification settings - Fork 3
/
MQAM_Comparison.m
59 lines (51 loc) · 1.91 KB
/
MQAM_Comparison.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
%--------------------------------------------------------------------------
% MQAM_Comparison.m -- ETSIT-UPM LTDS 2010-2011
%
% Analisys of several QAM modulation schemas returning the Bit Error Rate
% from each one for a given SNR.
%
% Authors:
% Luis Antonio Úbeda Medina ([email protected])
% Héctor Veiga Ortiz ([email protected])
%
% Input:
% SNR - Signal Noise Ratio for the AWGN Channel in dB.
%
% Example: MQAM_Comparison(5)
%
%
% Copyright 2010 Héctor Veiga Ortiz and Luis Antonio Úbeda Medina
%
%
% This file is part of MQAM Simulator.
%
% MQAM Simulator is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% MQAM Simulator is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with MQAM Simulator. If not, see <http://www.gnu.org/licenses/>.
%--------------------------------------------------------------------------
function MQAM_Comparison(SNR)
% Modulation deepness. Analysing until 4096-QAM.
% It would be possible to analyze bigger modulations adding
% integers to depth.
depth = [1 2 3 4 5 6];
% Amount of random bits
longitud = 2000;
BER=[];
% Analysing BER for each modulation. Showing results on screen.
disp('---------- M-QAM MODULATION COMPARISON ---------------------');
for n=1:length(depth)
nivel = 4^depth(n);
BER(n) = MqamMed(longitud,depth(n),SNR);
disp(['Modulation: ' num2str(nivel) '-QAM BER = ' num2str(BER(n))]);
end
disp('------------------------------------------------------------');
end