Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Garnier Jean-Romain
Performance of QPSK Modulation over Dowlink NOMA
Commits
6c202249
Commit
6c202249
authored
Nov 25, 2019
by
JRock007
Browse files
Fix convention for users' power
parent
4467e388
Changes
3
Hide whitespace changes
Inline
Side-by-side
Python/Model_N_receivers.py
View file @
6c202249
...
...
@@ -21,7 +21,7 @@ def generate(g, sigma, P, N):
signes
=
[
i
+
1
for
i
in
range
(
len
(
S
))
if
S
[
i
]
==
1
]
# Knowing the signs, we can compute the values of the amplitude for each user
r
=
[
math
.
sqrt
(
P
[
i
]
/
2
)
*
sgn
(
signes
,
i
+
1
)
for
i
in
range
(
len
(
P
))]
r
=
[
math
.
sqrt
(
P
[
i
])
*
sgn
(
signes
,
i
+
1
)
for
i
in
range
(
len
(
P
))]
# Sum the signals (to do NOMA)
x
=
sum
(
r
)
...
...
@@ -43,9 +43,9 @@ def decode(y, g, P, N):
for
i
in
range
(
N
,
0
,
-
1
):
# Decode the bit at index i
if
y
>
0
:
r_decoded
.
insert
(
0
,
g
*
math
.
sqrt
(
P
[
i
-
1
]
/
2
))
r_decoded
.
insert
(
0
,
g
*
math
.
sqrt
(
P
[
i
-
1
]))
else
:
r_decoded
.
insert
(
0
,
-
g
*
math
.
sqrt
(
P
[
i
-
1
]
/
2
))
r_decoded
.
insert
(
0
,
-
g
*
math
.
sqrt
(
P
[
i
-
1
]))
# Remove this decoded value from the interpreted value
y
-=
r_decoded
[
0
]
...
...
Python/Theory_N_receivers.py
View file @
6c202249
...
...
@@ -73,7 +73,7 @@ def theory(g, sigma, P, N, nuser=-1):
signes_bar
=
[
i
+
1
for
i
in
range
(
len
(
s
))
if
s
[
i
]
==
0
]
# Knowing the signs, the r_n can be computer
r
=
[
math
.
sqrt
(
P
[
i
]
/
2
)
*
sgn
(
signes
,
i
+
1
)
for
i
in
range
(
len
(
P
))]
r
=
[
math
.
sqrt
(
P
[
i
])
*
sgn
(
signes
,
i
+
1
)
for
i
in
range
(
len
(
P
))]
for
e
in
E_n
:
# Find the indices where an error is expected
...
...
Python/Theory_N_receivers_auto_develop.py
View file @
6c202249
...
...
@@ -59,13 +59,13 @@ def boundary_string(n, signs, epsilon, N_u):
nbr_items
+=
power_coeffs
[
i
-
1
]
!=
0
if
power_coeffs
[
i
-
1
]
==
2
:
formula
+=
" + 2
\\
sqrt{
\\
frac{
P_{"
+
str
(
i
)
+
"}}
{2}}
"
formula
+=
" + 2
\\
sqrt{P_{"
+
str
(
i
)
+
"}}"
elif
power_coeffs
[
i
-
1
]
==
1
:
formula
+=
" +
\\
sqrt{
\\
frac{
P_{"
+
str
(
i
)
+
"}}
{2}}
"
formula
+=
" +
\\
sqrt{P_{"
+
str
(
i
)
+
"}}"
elif
power_coeffs
[
i
-
1
]
==
-
1
:
formula
+=
" -
\\
sqrt{
\\
frac{
P_{"
+
str
(
i
)
+
"}}
{2}}
"
formula
+=
" -
\\
sqrt{P_{"
+
str
(
i
)
+
"}}"
elif
power_coeffs
[
i
-
1
]
==
-
2
:
formula
+=
" - 2
\\
sqrt{
\\
frac{
P_{"
+
str
(
i
)
+
"}}
{2}}
"
formula
+=
" - 2
\\
sqrt{P_{"
+
str
(
i
)
+
"}}"
# Format it (remove the leading " + ", and replace the leading " - " by "-")
if
len
(
formula
)
>
0
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment