-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy path10dB _to_40dB.py
More file actions
37 lines (32 loc) · 933 Bytes
/
10dB _to_40dB.py
File metadata and controls
37 lines (32 loc) · 933 Bytes
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
import numpy as np
import math as math
import matplotlib.pyplot as plt
from SphereDecodingAlgo import *
pltx = []
m = n = 10
rangee = range(5,30,5)
plty = [[0 for i in rangee] for _ in range(4)]
for SNRdB in rangee:
pltx.append(SNRdB)
idd = 0
for qam in [2,4,8,16]:
for go in range(100):
cnt = 0
for SNRdB in rangee:
SNR = math.pow(10,SNRdB/10)
variance = (m) / (SNR)
H = np.random.normal(0,1,(n,m))
flopsCount , ans, answer = sphereDecoding(m,n,H,variance,[],[],qam)
plty[idd][cnt] += (math.log(flopsCount,m))/100
cnt += 1
idd += 1
plt.plot(pltx,plty[0],label= '4QAM')
plt.plot(pltx,plty[1],'rx-',label= '16QAM')
plt.plot(pltx,plty[2],'go-',label= '64QAM')
plt.plot(pltx,plty[3],'ys-',label= '256QAM')
plt.xlim(5,25)
plt.ylabel('ec')
plt.xlabel('SNR[dB]')
plt.title("n = m = 10, through 10dB - 40dB")
plt.legend()
plt.show()