IT++ Logo
Public Member Functions | Protected Attributes | List of all members
itpp::Spread_1d Class Reference

Spreading of float symbols to float output. More...

#include <itpp/comm/spread.h>

Public Member Functions

 Spread_1d ()
 Constructor. More...
 
 Spread_1d (const vec &incode)
 Constructor. More...
 
void spread (const vec &symbols, vec &out)
 Spreading of signal return i out. More...
 
vec spread (const vec &symbols)
 Spreading of signal. More...
 
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. More...
 
vec despread (const vec &rec_signal, int timing)
 Despreading of signal. timing is the start position of the first symbol, given in number of samples. More...
 
void set_code (const vec &incode)
 Set the spreading code used for spreading. More...
 
vec get_code ()
 Returns the spreading code used. More...
 
int get_period ()
 Get the period of the code (length of code vector). More...
 

Protected Attributes

vec code
 The spreading code. More...
 
int N
 The spreading factor. More...
 

Detailed Description

Spreading of float symbols to float output.

Spreading block for generation of 1-dimensional DS-CDMA signals Useful in the simulation of DS-CDMA systems on chip level or upsampled chip level.

Obeserve that the spreading is normalized so that the energy per bit is preserved before and after spreading (that is each symbol is multiplied with 1/sqrt(N)). Hence, for the multicode case the energy is normalized for one symbol (code) but the transmitted signal consist of a sum of several signals.

Four different classes exist:

For multicode transmission, that is each user uses several codes in parallel to transmit data, there exist

Example:

#include "itpp/itcomm.h"
int main() {
//Generate the spreading code you want to use.
vec spreading_code = "-1 1 -1 1";
//Initiate th Spreading class
Spread_1d spread_1d(spreading_code);
//Generate the symbols to transmitt
bvec transmitted_bits = randb(10);
BPSK bpsk;
vec transmitted_symbols = bpsk.modulate_bits(transmitted_bits);
//Spread the symbols
vec transmitted_signal = spread_1d.spread(transmitted_symbols);
//Generate the received signal
vec received_signal = transmitted_signal;
//Despread the received signal
vec received_symbols = spread_1d.despread(received_signal,0);
//demodulate the bits
bvec received_bits = bpsk.demodulate_bits(received_symbols);
}
BPSK modulator with real symbols.
Definition: modulator.h:877
void modulate_bits(const bvec &bits, vec &output) const
Modulate bits into BPSK symbols in complex domain.
Definition: modulator.cpp:310
void demodulate_bits(const vec &signal, bvec &output) const
Demodulate noisy BPSK symbols in complex domain into bits.
Definition: modulator.cpp:326
Spreading of float symbols to float output.
Definition: spread.h:100
bin randb(void)
Generates a random bit (equally likely 0s and 1s)
Definition: random.h:793
Include file for the IT++ communications module.

Definition at line 99 of file spread.h.

Constructor & Destructor Documentation

◆ Spread_1d() [1/2]

itpp::Spread_1d::Spread_1d ( )
inline

Constructor.

Definition at line 103 of file spread.h.

◆ Spread_1d() [2/2]

itpp::Spread_1d::Spread_1d ( const vec &  incode)

Constructor.

Definition at line 39 of file spread.cpp.

References set_code().

Member Function Documentation

◆ spread() [1/2]

void itpp::Spread_1d::spread ( const vec &  symbols,
vec &  out 
)

Spreading of signal return i out.

Definition at line 56 of file spread.cpp.

References code, and N.

Referenced by itpp::Spread_2d::spread().

◆ spread() [2/2]

vec itpp::Spread_1d::spread ( const vec &  symbols)
inline

Spreading of signal.

Definition at line 109 of file spread.h.

References spread().

Referenced by spread().

◆ despread() [1/2]

void itpp::Spread_1d::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.

Definition at line 64 of file spread.cpp.

References code, and N.

Referenced by itpp::Spread_2d::despread().

◆ despread() [2/2]

vec itpp::Spread_1d::despread ( const vec &  rec_signal,
int  timing 
)
inline

Despreading of signal. timing is the start position of the first symbol, given in number of samples.

Definition at line 117 of file spread.h.

◆ set_code()

void itpp::Spread_1d::set_code ( const vec &  incode)

Set the spreading code used for spreading.

Definition at line 44 of file spread.cpp.

References code, N, and itpp::norm().

Referenced by itpp::Spread_2d::set_code(), and Spread_1d().

◆ get_code()

vec itpp::Spread_1d::get_code ( )

Returns the spreading code used.

Definition at line 51 of file spread.cpp.

References code.

Referenced by itpp::Spread_2d::get_codeI(), and itpp::Spread_2d::get_codeQ().

◆ get_period()

int itpp::Spread_1d::get_period ( )
inline

Get the period of the code (length of code vector).

Definition at line 124 of file spread.h.

Member Data Documentation

◆ code

vec itpp::Spread_1d::code
protected

The spreading code.

Definition at line 127 of file spread.h.

Referenced by despread(), get_code(), set_code(), and spread().

◆ N

int itpp::Spread_1d::N
protected

The spreading factor.

Definition at line 129 of file spread.h.

Referenced by despread(), set_code(), and spread().


The documentation for this class was generated from the following files:
SourceForge Logo

Generated on Tue Jan 24 2023 00:00:00 for IT++ by Doxygen 1.9.5