# Hexagonal Modulator Comparison with Square Modulator

Hexagonal shaped Modulator is designed to get better BER than Square Modulator. The constellation diagram is like the figure:

It is supposed to give better BER measurement than Square as it has wider decision boundary. I have designed the modulator in this way.

## Modulator for hexagonal

a2=[-2 -2 0 0 2 2 4 4];
a2=a2(:);
d=[1 -3 1 -3 1 -3 1 -3];
z1=a2+j*d(:);
z=[z;z1];
%plot(z,'O')

for i=1:length(s)
lodd=s(i);
ModDat(i)=z(lodd+1);


## Demodulator for Hexagonal

a=[-3:2:3];
b=[3 -1 3 -1 3 -1 3 -1];
a=[a;-a];
a=a(:);
z=a+j*b(:);
%a2=[a2;-a2];

a2=[-2 -2 0 0 2 2 4 4];
a2=a2(:);
d=[1 -3 1 -3 1 -3 1 -3];
z1=a2+j*d(:);
z=[z;z1];
for fd=1:length(s)

for l=1:16; tes(l)=z(l)-s(fd); end
abs_dat_c=((abs(tes)).^2)';
min_dat=min(abs_dat_c);

for ds=1:16; if min_dat==abs_dat_c(ds); demoddat(fd)=ds-1;
end;
end
demoddat=demoddat(:);


## BER Measurement

N=170000;                       % No Of Symbols
M=16;
Sr=randint(N,1,[0,(M-1)]);      % random data form 0-15
s1=hexmod(Sr,M);  s1=s1(:);             % generate 16-qam data
% s2=qammod(Sr,M,0,'gray');s2=s2(:);
s2=qammod(Sr,M);s2=s2(:);

SNR=1:1:15
for k=1:length(SNR)
%% add noise---> LPN; CD; AWGN for ASE %%
Square_AWGN_Theory=awgn(s2,(SNR(k)+(10*log10(log2(M)))),'measured'); % Square Modulation
Hexagonal_AWGN_Theory= awgn(s1,(SNR(ppn)+(10*log10(log2(M)))),'measured'); % Hexagonal modulation

%% Demodulation Hexagonal
y1_Theory_hex=hexdemod(Hexagonal_AWGN_Theory,M);
y1_Theory_hex=y1_Theory_hex(:);
% [no_of_error_Theory_hex(ppn)

BER_Theory_hex(ppn)]=biterr(Sr(20000:length(y1_Theory_hex)-100),y1_Theory_hex(20000:
(length(y1_Theory_hex)-100)))
[no_of_error_Theory_hex(ppn)
BER_Theory_hex(ppn)]=symerr(Sr(20000:length(y1_Theory_hex)-100),
y1_Theory_hex(20000:(length(y1_Theory_hex)-100)))

%% Square Demodulation
y1_Theory_sq=qamdemod(Square_AWGN_Theory,M);
y1_Theory_sq=y1_Theory_sq(:);
% [no_of_error_Theory_sq(ppn)
BER_Theory_sq(ppn)]=biterr(Sr(20000:length(y1_Theory_sq)-100),
y1_Theory_sq(20000:(length(y1_Theory_sq)-100)))
[no_of_error_Theory_sq(ppn)

BER_Theory_sq(ppn)]=symerr(Sr(20000:length(y1_Theory_sq)-100),
y1_Theory_sq(20000:(length(y1_Theory_sq)-100)))
end


## My Questions/Query

It is supposed that Hexagonal must give better result but i am not getting. although SER (symbol error rate is almost same ) but BER is not perfect. so please give me some suggestion by which i can get better result.

How to make differential coding for this Hexagonal Modulator ?

How to make the theoretical calculation to get a proper equation for this hexagonal modulator ?

• Who supposes that the hexagonal constellation is superior in terms of BER? I'm not saying it isn't, but if you have a reference it would be useful. I've not seen such an arrangement before. When you do comparisons such as these, you must be very careful about calculating SNR, typically specified as Eb/No, correctly. I haven't run it, but your MATLAB code above looks like it's incomplete. What is ppn in the last code section? – Jason R Aug 3 '12 at 21:54

For a rectangular QAM constellation, calculation of the symbol error rate is straightforward. Exact calculation of the bit error rate is somewhat more complicated, but approximations are more easily calculated based on the following assumptions.

• Each signal point has four nearest neighbors (interior point) or three nearest neighbors (edge points), or two nearest neighbors (corner points), Note that 16-QAM has 4 interior points, 8 edge points, and 4 corner points.

• The probability that a transmitted signal point is demodulated into a nearest neighbor is orders of magnitude than the probability that it is demodulated into a more distant point

• A syymbol error results in exactly one bit error (that is, data bits are assigned to signal points in Gray code order) so that the data bits assigned to a signal point differ from the data bits assigned to a nearest neighbor in just one bit position.

For the 16-ary hexagonal constellation with regular equiangular hexagons (similar to but not quite the same as the constellation shown in the question), the 4 interior points have 6 nearest neighbors instead of 4 while the edge points have 4 nearest neighbors on average (some have 3 and some have 5, others have 4 exactly), and two corner points have 3 nearest neighbors. This has two effects. First, for a given spacing between signal points, a symbol error is more likely since there are more neighbors. Second, a symbol error can result in more than one bit error. Thus, it is necessary to adjust the spacing between nearest neighbors to compensate for this if one wants to have the same BER, and this will typically increase the signal power needed. In short, it is not immediately obvious that

It is supposed to give better BER measurement than Square as it has wider decision boundary

is a believable claim. In any case, the width of the decision boundary is not quite as relevant to the BER calculation as the distance of the constellation points from the decision boundaries, and the number of nearest neighbors that each signal point has.

I don't decipher MATLAB very well, but if the picture with the 16 blobs was created by the MATLAB program included, then I don't think that the constellation that has been created is a (regular) hexagonal constellation at all. It looks for all the world like you began with a rectangular 16-QAM signal constellation (which has points at $(\pm m, \pm n)$ for $m, n \in \{1, 3\}$) and moved the second and fourth rows by $1$ to the right, so that the $x$ coordinate is $-2, 0, 2, 4$ instead of $-3, -1, 1, 3$. Note that this increases the maximum signal amplitude in one branch (I in this case) from $3$ to $4$ so that the amplifiers have to have greater dynamic range and the energy per bit also has increased. Any comparison of the BER performance must take into account the fact that the hexagonal constellation shown is operating at a larger SNR than the standard rectangular 16-QAM constellation. In a regular hexagonal constellation (which is what my remarks above apply to), the points are at the vertices (and centers) of regular (equiangular) hexagons and are equidistant from their nearest neighbors, while your distances are $2$ and $\sqrt{5}$ respectively.

• ppn is nothing.. its like a veriable which is used for for looping you can consider it as 'k' – user1468033 Aug 4 '12 at 3:27
• so will you please tell me how to code for hexagonal QAM system – user1468033 Aug 4 '12 at 5:03
• @user1468033 You need to figure out the locations of the constellation points and then assign data bits to each. But maybe the hexagonal constellation that your system is using is the one that is created by your MATLAB program, and what you are trying to do is verify the claim about better BER performance. If so, that is a MATLAB programming question for which I have no answer; I am not a MATLAB programmer. – Dilip Sarwate Aug 4 '12 at 12:36

The constellation you should use depends on the characteristics of channel, Triangular, Square or Hexagonal could all be "the best".

Calculating the actual BER/SER is a tough problem that, as Dilip said, relies on how many other constellations fall within the decision boundary.

For the theoretical calculation please refer to this excellent paper that compares different arrangements of the constellation and compares them against each other with a fantastic summary.

CONCLUSION: It was shown that, TQAM achieves approximately the minimum SER over the whole range of SNRs and that it is an efficient solution when the choice of the modulation is based on the SER minimization. On the other hand, the minimum BER is achieved for an angle different from 𝜃=60𝑜 (TQAM). Furthermore, it was shown that in fading channels, SQAM is the optimum constellation in terms of BER. (http://users.auth.gr/geokarag/pdf/Theta.pdf)