aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--octave/ofdm_lib.m8
-rw-r--r--octave/qam16.m2
-rw-r--r--src/ofdm.c10
3 files changed, 7 insertions, 13 deletions
diff --git a/octave/ofdm_lib.m b/octave/ofdm_lib.m
index 18a1df9..93a2da7 100644
--- a/octave/ofdm_lib.m
+++ b/octave/ofdm_lib.m
@@ -73,9 +73,9 @@ function states = ofdm_init(config)
states.Nsampersymbol = states.M+states.Ncp; % number of samples in a single symbol
states.Nsamperframe = Ns*states.Nsampersymbol; % number of samples in a modem frame
states.qam16 = [
- 1 + j, 1 + j*3, 3 + j, 3 + j*3;
- 1 - j, 1 - j*3, 3 - j, 3 - j*3;
- -1 + j, -1 + j*3, -3 + j, -3 + j*3;
+ 1 + j, 1 + j*3, 3 + j, 3 + j*3, ...
+ 1 - j, 1 - j*3, 3 - j, 3 - j*3, ...
+ -1 + j, -1 + j*3, -3 + j, -3 + j*3, ...
-1 - j, -1 - j*3, -3 - j, -3 - j*3];
rms = sqrt(states.qam16(:)'*states.qam16(:)/16);% set average Es to 1
states.qam16 /= rms;
@@ -127,7 +127,7 @@ function states = ofdm_init(config)
states.uw_ind = [states.uw_ind bps*ind_sym-b]; % bit index
end
end
-
+
% how many of the first few frames have UW symbols in them
Nsymsperframe = states.Nbitsperframe/states.bps;
states.Nuwframes = ceil(states.uw_ind_sym(end)/Nsymsperframe);
diff --git a/octave/qam16.m b/octave/qam16.m
index 5b0f047..7d2dff4 100644
--- a/octave/qam16.m
+++ b/octave/qam16.m
@@ -25,7 +25,7 @@ function test_qam16_mod_demod(constellation)
for decimal=0:15
tx_bits = zeros(1,4);
for i=1:4
- tx_bits(1,5-i) = bitand(bitshift(decimal-1,1-i),1);
+ tx_bits(1,5-i) = bitand(bitshift(decimal,1-i),1);
end
symbol = qam16_mod(constellation, tx_bits);
rx_bits = qam16_demod(constellation,symbol);
diff --git a/src/ofdm.c b/src/ofdm.c
index 4fee2ec..26fb201 100644
--- a/src/ofdm.c
+++ b/src/ofdm.c
@@ -75,13 +75,7 @@ static void ofdm_demod_core(struct OFDM *, int *);
*/
static const complex float qpsk[] = {1.0f + 0.0f * I, 0.0f + 1.0f * I,
0.0f - 1.0f * I, -1.0f + 0.0f * I};
-/*
-static const complex float qam16[] = {
- 1.0f + 1.0f * I, 1.0f + 3.0f * I, 3.0f + 1.0f * I, 3.0f + 3.0f * I,
- 1.0f - 1.0f * I, 1.0f - 3.0f * I, 3.0f - 1.0f * I, 3.0f - 3.0f * I,
- -1.0f + 1.0f * I, -1.0f + 3.0f * I, -3.0f + 1.0f * I, -3.0f + 3.0f * I,
- -1.0f - 1.0f * I, -1.0f - 3.0f * I, -3.0f - 1.0f * I, -3.0f - 3.0f * I};
-*/
+
static const complex float qam16[] = {
4.4721e-01 + 2.7756e-17 * I, 8.9443e-01 + 4.4721e-01 * I,
8.9443e-01 - 4.4721e-01 * I, 1.3416e+00 + 1.1102e-16 * I,
@@ -91,6 +85,7 @@ static const complex float qam16[] = {
-4.4721e-01 + 8.9443e-01 * I, -1.1102e-16 + 1.3416e+00 * I,
-4.4721e-01 - 2.7756e-17 * I, -8.9443e-01 - 4.4721e-01 * I,
-8.9443e-01 + 4.4721e-01 * I, -1.3416e+00 - 1.1102e-16 * I};
+
/*
* These pilots are compatible with Octave version
*/
@@ -476,7 +471,6 @@ struct OFDM *ofdm_create(const struct OFDM_CONFIG *config) {
ofdm->tx_uw_syms =
MALLOC(sizeof(complex float) * (ofdm->nuwbits / ofdm->bps));
assert(ofdm->tx_uw_syms != NULL);
-
for (int b = 0, s = 0; b < ofdm->nuwbits; b += ofdm->bps, s++) {
int bits[ofdm->bps];
for (int i = 0; i < ofdm->bps; i++)