#include <itpp/comm/spread.h>
Public Member Functions | |
Spread_1d () | |
Constructor. | |
Spread_1d (const vec &incode) | |
Constructor. | |
void | spread (const vec &symbols, vec &out) |
Spreading of signal return i out. | |
vec | spread (const vec &symbols) |
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 | despread (const vec &rec_signal, int timing) |
Despreading of signal. timing is the start position of the first symbol, given in number of samples. | |
void | set_code (const vec &incode) |
Set the spreading code used for spreading. | |
vec | get_code () |
Returns the spreading code used. | |
short | get_period () |
Get the period of the code (length of code vector). | |
Protected Attributes | |
vec | code |
The spreading code. | |
short | N |
The spreading factor. |
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); }
Definition at line 102 of file spread.h.
|
Constructor.
|
|
Constructor.
Definition at line 41 of file spread.cpp. References set_code(). |
|
Spreading of signal return i out.
Definition at line 58 of file spread.cpp. References code, itpp::Vec< Num_T >::length(), N, itpp::Vec< Num_T >::replace_mid(), and itpp::Vec< Num_T >::set_size(). Referenced by itpp::Spread_2d::spread(). |
|
Spreading of signal.
|
|
Despreading of signal. timing is the start position of the first symbol, given in number of samples.
Definition at line 66 of file spread.cpp. References itpp::floor(), itpp::Vec< Num_T >::length(), itpp::Vec< Num_T >::mid(), N, and itpp::Vec< Num_T >::set_size(). Referenced by itpp::Spread_2d::despread(). |
|
Despreading of signal. timing is the start position of the first symbol, given in number of samples.
|
|
Set the spreading code used for spreading.
Definition at line 46 of file spread.cpp. References code, N, itpp::norm(), and itpp::Vec< Num_T >::size(). Referenced by itpp::Spread_2d::set_code(), and Spread_1d(). |
|
Returns the spreading code used.
Definition at line 53 of file spread.cpp. Referenced by itpp::Spread_2d::get_codeI(), and itpp::Spread_2d::get_codeQ(). |
|
Get the period of the code (length of code vector).
|
|
The spreading code.
Definition at line 129 of file spread.h. Referenced by set_code(), and spread(). |
|
The spreading factor.
Definition at line 131 of file spread.h. Referenced by despread(), set_code(), and spread(). |
Generated on Fri Jan 11 08:51:43 2008 for IT++ by Doxygen 1.3.9.1