58 out.set_size(symbols.length()*
N,
false);
60 for (
int i = 0;i < symbols.length();i++)
61 out.replace_mid(i*
N, symbols(i)*
code);
66 int nosymbols = (int)
std::floor(
double((rec_signal.length() - timing)) /
N);
67 out.set_size(nosymbols);
69 for (
int i = 0;i < nosymbols;i++)
70 out(i) = rec_signal.mid(i *
N + timing,
N) *
code;
93 it_assert(incodeI.length() == incodeQ.length(),
"Size of I and Q codes doesn't match");
123 for (
int i = 0; i <
L; i++)
135 int nomcsymbols = (int)
std::floor(
double(symbols.length() /
L));
136 vec temp(nomcsymbols*
N);
138 for (i = 0;i < nomcsymbols;i++) {
139 temp.replace_mid(i*
N,
codes.T() * symbols.mid(i*
L,
L));
148 int nosymbols = (int)
std::floor(
double((receivedsignal.length() - timing)) /
N);
149 vec temp(nosymbols*
L);
151 for (i = 0;i < nosymbols;i++) {
152 temp.replace_mid(i*
L,
codes*receivedsignal.mid(i*
N + timing,
N));
178 it_assert(incodesI.rows() == incodesQ.rows() && incodesI.cols() == incodesQ.cols(),
179 "Multicode_Spread_2d::set_codes(): dimension mismatch");
vec despread(const vec &receivedsignal, int timing)
Despreading of signal. timing is the start position of the first symbol, given in number of samples...
vec code
The spreading code.
Multicode_Spread_2d()
Constructor.
int N
The spreading factor.
void despread(const cvec &rec_signal, cvec &out, int timing)
Despreading of signal. timing is the start position of the first symbol, given in number of samples...
vec imag(const cvec &data)
Imaginary part of complex values.
void set_codes(const mat &incodes)
Set the spreading codes. Each row represent one spreading code. The spreading factor equals the numbe...
Multicode_Spread_1d mcspreadQ
vec floor(const vec &x)
Round to nearest lower integer.
double norm(const cvec &v)
Calculate the 2-norm: norm(v)=sqrt(sum(abs(v).^2))
void spread(const vec &symbols, vec &out)
Spreading of signal return i out.
vec spread(const vec &symbols)
Spreading function.
vec get_codeI()
Returns the in-phase spreading code.
void set_code(const vec &incodeI, const vec &incodeQ)
Set the in-phase and the quadrature-phase spreading codes.
#define it_assert(t, s)
Abort if t is not true.
void set_code(const vec &incode)
Set the spreading code used for spreading.
void set_codes(const mat &incodesI, const mat &incodesQ)
Set the spreading codes.
int N
The spreading factor.
Definitions of converters between different vector and matrix types.
int L
The number of multi-codes.
vec get_code()
Returns the spreading code used.
mat get_codes()
Returns the matrix containing the spreading codes used as rows in the matrix.
Miscellaneous statistics functions and classes - header file.
void spread(const cvec &symbols, cvec &out)
Spreading of signal.
void despread(const vec &rec_signal, vec &out, int timing)
Despreading of signal. timing is the start position of the first symbol, given in number of samples...
vec get_codeQ()
Returns the quadrature-phase spreading code.
Definition of spread spectrum classes and functions.
mat codes
The spreading codes used size ( )
cvec to_cvec(const Vec< T > &v)
Converts a Vec<T> to cvec.
mat get_codesQ()
Return the matrix containing the quadrature-phase codes (as rows)
Multicode_Spread_1d mcspreadI
cvec spread(const cvec &symbols)
Spreading of signal.
cvec despread(const cvec &receivedsignal, int timing)
Despreading of signal. timing is the start position of the first symbol, given in number of samples...
vec real(const cvec &data)
Real part of complex values.
Multicode_Spread_1d()
Constructor.
mat get_codesI()
Return the matrix containing the in-phase codes (as rows)