Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2019-1-software-lab-1
/
0509_team4
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
윤보민
2019-05-12 20:21:58 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
63d3b6fade57a85a36d2c7dea56fce3e2fede807
63d3b6fa
1 parent
8a693ec8
last change of receiver part
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
42 additions
and
33 deletions
constellation/.vs/constellation/v15/.suo
constellation/.vs/constellation/v15/Browse.VC.db
constellation/.vs/constellation/v15/ipch/AutoPCH/7a8270f0cb7c902a/MYMATRIX.ipch
constellation/.vs/constellation/v15/ipch/AutoPCH/aa5e61815b09e3fc/RECEIVER.ipch
constellation/constellation/myMatrix.cpp
constellation/constellation/myMatrix.h
constellation/constellation/receiver.cpp
constellation/constellation/receiver.h
constellation/.vs/constellation/v15/.suo
View file @
63d3b6f
No preview for this file type
constellation/.vs/constellation/v15/Browse.VC.db
View file @
63d3b6f
No preview for this file type
constellation/.vs/constellation/v15/ipch/AutoPCH/7a8270f0cb7c902a/MYMATRIX.ipch
0 → 100644
View file @
63d3b6f
This file is too large to display.
constellation/.vs/constellation/v15/ipch/AutoPCH/aa5e61815b09e3fc/RECEIVER.ipch
View file @
63d3b6f
No preview for this file type
constellation/constellation/myMatrix.cpp
View file @
63d3b6f
#include <iostream>
#include "myMatrix.h"
using
namespace
std
;
void
scalarmult
(
int
n
,
int
m
,
float
a
,
float
*
b
,
float
*
c
){
int
N
=
n
*
m
;
for
(
int
i
=
0
;
i
<
N
;
i
++
)
c
[
i
]
=
a
*
b
[
i
];
float
dot
(
int
N
,
float
*
C
,
float
*
D
)
{
float
sum
=
0.0
;
for
(
int
i
=
0
;
i
<
N
;
i
++
)
sum
+=
C
[
i
]
*
D
[
i
];
return
sum
;
}
void
scalarmult
(
int
n
,
int
m
,
float
a
,
float
*
b
,
float
*
c
)
{
int
N
=
n
*
m
;
for
(
int
i
=
0
;
i
<
N
;
i
++
)
c
[
i
]
=
a
*
b
[
i
];
}
void
matrixadd
(
int
n
,
int
m
,
float
*
a
,
float
*
b
,
float
*
c
){
int
N
=
n
*
m
;
for
(
int
i
=
0
;
i
<
N
;
i
++
)
c
[
i
]
=
a
[
i
]
+
b
[
i
];
void
matrixadd
(
int
n
,
int
m
,
float
*
a
,
float
*
b
,
float
*
c
)
{
int
N
=
n
*
m
;
for
(
int
i
=
0
;
i
<
N
;
i
++
)
c
[
i
]
=
a
[
i
]
+
b
[
i
];
}
// (N by K) C X (K by M) D = (N by M) E
void
matrixmult
(
int
N
,
int
K
,
int
M
,
float
*
C
,
float
*
D
,
float
*
E
)
{
...
...
constellation/constellation/myMatrix.h
View file @
63d3b6f
void
scalarmult
(
int
n
,
int
m
,
float
a
,
float
*
b
,
float
*
c
);
void
matrixadd
(
int
n
,
int
m
,
float
*
a
,
float
*
b
,
float
*
c
);
void
matrixmult
(
int
N
,
int
K
,
int
M
,
float
*
C
,
float
*
D
,
float
*
E
);
float
dot
(
int
N
,
float
*
C
,
float
*
D
);
int
GaussElimination
(
int
,
float
*
,
float
*
);
void
showMatrix
(
int
n
,
int
m
,
float
*
F
);
void
showMatrix
(
char
*
name
,
int
n
,
int
m
,
float
*
F
);
...
...
constellation/constellation/receiver.cpp
View file @
63d3b6f
#include "receiver.h"
Creceiver
::
Creceiver
()
{}
void
Creceiver
::
demodulate
()
{
T
=
Nsamplespersymbol
;
float
c0
[
Nsamplespersymbol
],
c1
[
Nsamplespersymbol
];
for
(
int
i
=
1
;
i
<=
Nsamplespersymbol
;
i
++
)
{
c0
[
i
-
1
]
=
sqrt
(
2
/
T
)
*
cos
(
2
*
PI
/
T
*
i
);
c1
[
i
-
1
]
=
sqrt
(
2
/
T
)
*
sin
(
2
*
PI
/
T
*
i
);
}
float
temp0
[
1
],
temp1
[
1
];
for
(
int
i
=
0
;
i
<
Nbits
/
2
;
i
++
)
{
matrixmult
(
1
,
Nsamplespersymbol
,
1
,
r
+
(
Nbitspersymbol
*
i
),
c0
,
temp0
);
matrixmult
(
1
,
Nsamplespersymbol
,
1
,
r
+
(
Nbitspersymbol
*
i
),
c1
,
temp1
);
constellation
[
2
*
i
]
=
temp0
[
0
];
constellation
[
2
*
i
+
1
]
=
temp1
[
0
];
#include "myMatrix.h"
Creceiver
::
Creceiver
()
{
float
t
=
0.0
,
T
=
0.01
;
float
dt
=
T
/
Nsamplespersymbol
;
c0t
=
new
float
[
Nsamplespersymbol
];
c1t
=
new
float
[
Nsamplespersymbol
];
for
(
int
i
=
0
;
i
<
Nsamplespersymbol
;
i
++
,
t
+=
dt
)
{
c0t
[
i
]
=
cos
(
2.
*
3.141592
*
t
/
T
);
c1t
[
i
]
=
sin
(
2.
*
3.141592
*
t
/
T
);
}
for
(
int
j
=
0
;
j
<
Nbits
;
j
++
)
{
if
(
constellation
[
j
]
>=
0
)
DecodedData
[
j
]
=
'0'
;
else
DecodedData
[
j
]
=
'1'
;
}
void
Creceiver
::
demodulate
()
{
int
nn
=
Nsamplespersymbol
/
Nbitspersymbol
;
for
(
int
i
=
0
;
i
<
Nbits
;
i
+=
2
)
{
int
symbol
=
detectSymbol
(
constellation
+
i
,
r
+
i
*
nn
);
if
(
symbol
==
0
)
{
DecodedData
[
i
]
=
0
;
DecodedData
[
i
+
1
]
=
0
;
}
else
if
(
symbol
==
1
)
{
DecodedData
[
i
]
=
1
;
DecodedData
[
i
+
1
]
=
0
;
}
else
if
(
symbol
==
2
)
{
DecodedData
[
i
]
=
1
;
DecodedData
[
i
+
1
]
=
1
;
}
else
{
DecodedData
[
i
]
=
0
;
DecodedData
[
i
+
1
]
=
1
;
}
}
}
int
Creceiver
::
detectSymbol
(
float
*
co
,
float
*
rr
)
{
float
dummy
[
Nbitspersymbol
];
co
[
0
]
=
dot
(
Nsamplespersymbol
,
rr
,
c0t
);
co
[
1
]
=
dot
(
Nsamplespersymbol
,
rr
,
c1t
);
if
(
co
[
0
]
>=
0
&&
co
[
1
]
>=
0
)
return
0
;
else
if
(
co
[
0
]
<
0
&&
co
[
1
]
>=
0
)
return
1
;
else
if
(
co
[
0
]
<
0
&&
co
[
1
]
<
0
)
return
2
;
return
3
;
}
\ No newline at end of file
...
...
constellation/constellation/receiver.h
View file @
63d3b6f
#ifndef __RECEIVER
#define __RECEIVER
#define PI 3.141592
#include <cmath>
#include <fstream>
#include "variables.h"
#include "myMatrix.h"
class
Creceiver
{
public
:
float
T
;
Creceiver
();
float
*
r
;
// corrupted signal = received signal
float
constellation
[
Nbits
];
char
DecodedData
[
Nbits
];
void
demodulate
();
int
detectSymbol
(
float
*
,
float
*
);
float
*
c0t
,
*
c1t
;
};
#endif
...
...
Please
register
or
login
to post a comment