72 template<
class T1,
class T2,
class T3>
174 double get_roll_off(
void)
const;
238 double get_roll_off(
void)
const;
251 template<
class T1,
class T2,
class T3>
260 template<
class T1,
class T2,
class T3>
266 template<
class T1,
class T2,
class T3>
269 it_error_if(impulse_response_in.
size() == 0,
"Pulse_Shape: impulse response is zero length");
270 it_error_if(upsampling_factor_in < 1,
"Pulse_Shape: incorrect upsampling factor");
281 template<
class T1,
class T2,
class T3>
287 template<
class T1,
class T2,
class T3>
293 template<
class T1,
class T2,
class T3>
299 template<
class T1,
class T2,
class T3>
305 template<
class T1,
class T2,
class T3>
318 template<
class T1,
class T2,
class T3>
327 template<
class T1,
class T2,
class T3>
340 template<
class T1,
class T2,
class T3>
349 template<
class T1,
class T2,
class T3>
367 it_error_if(roll_off_factor_in < 0 || roll_off_factor_in > 1,
"Raised_Cosine: roll-off out of range");
368 roll_off_factor = roll_off_factor_in;
381 t = (double)(i - filter_length * upsampling_factor_in / 2)
382 / upsampling_factor_in;
383 den = 1 -
sqr(2 * roll_off_factor * t);
411 return roll_off_factor;
425 it_error_if(roll_off_factor_in <= 0 || roll_off_factor_in > 1,
426 "Root_Raised_Cosine: roll-off out of range");
427 roll_off_factor = roll_off_factor_in;
430 "Root_Raised_Cosine: Filter length not even");
433 double t, num, den, tmp_arg;
441 t = (double)(i - filter_length * upsampling_factor_in / 2)
442 / upsampling_factor_in;
443 den = 1 -
sqr(4 * roll_off_factor * t);
449 tmp_arg =
pi / (4 * roll_off_factor);
454 num =
std::sin(
pi * (1 - roll_off_factor) * t)
455 +
std::cos(
pi * (1 + roll_off_factor) * t) * 4 * roll_off_factor * t;
470 return roll_off_factor;
481 std::complex<double> >;
482 ITPP_EXPORT_TEMPLATE
template class ITPP_EXPORT Pulse_Shape < std::complex<double>, std::complex<double>,
483 std::complex<double> >;
495 #endif // #ifndef PULSE_SHAPE_H int size() const
The size of the vector.
#define it_error_if(t, s)
Abort if t is true.
Various functions on vectors and matrices - header file.
Root_Raised_Cosine()
Constructor.
Vec< T2 > impulse_response
The impulse resounse of the pulse shaping filter.
void set_pulse_shape(double roll_off_factor, int filter_length=6, int upsampling_factor=8)
Set pulse shape (roll_off_factor between 0 and 1, filter_length even)
void clear(void)
Clear internal states.
Definitions of Filter classes and functions.
bool is_even(int x)
Return true if x is an even integer.
void shape_samples(const Vec< T1 > &input, Vec< T3 > &output)
Shape the input samples already upsampled.
Pulse_Shape()
Constructor.
int upsampling_factor
Samples per input symbol.
double sinc(double x)
Sinc function: sinc(x) = sin(pi*x)/pi*x.
int get_filter_length() const
Get the length of the internal FIR filter.
MA_Filter< T1, T2, T3 > shaping_filter
The pulse shaping filter.
void set_size(int size, bool copy=false)
Set length of vector. if copy = true then keeping the old values.
Raised Cosine (RC) Pulse Shaper.
#define it_assert(t, s)
Abort if t is not true.
void set_pulse_shape(const Vec< T2 > &impulse_response, int upsampling_factor)
Set the general impulse response of the FIR filter.
double roll_off_factor
The roll off factor (i.e. alpha)
double roll_off_factor
The roll off factor (i.e. alpha)
vec sin(const vec &x)
Sine function.
double get_roll_off(void) const
Get the roll-off factor.
const double pi
Constant Pi.
virtual ~Raised_Cosine()
Destructor.
Trigonometric and hyperbolic functions - header file.
Moving Average Filter Base Class.This class implements a moving average (MA) filter according to whe...
virtual ~Root_Raised_Cosine()
Destructor.
int get_pulse_length() const
Get the length of the pulse in number of symbols.
virtual ~Pulse_Shape()
Destructor.
bool setup_done
Ensures that setup is called before any other member function.
Resampling functions - header file.
Raised_Cosine()
Constructor.
double get_roll_off(void) const
Get the Roll-off factor.
vec sqr(const cvec &data)
Absolute square of elements.
void shape_symbols(const Vec< T1 > &input, Vec< T3 > &output)
Shape the input symbols performing upsampling.
int pulse_length
Length in symbols.
Vec< T2 > get_pulse_shape(void) const
Get the pulse shape.
vec sqrt(const vec &x)
Square root of the elements.
int get_upsampling_factor() const
Get the over sampling factor.
void set_pulse_shape(double roll_off_factor, int filter_length=6, int upsampling_factor=8)
Set pulse_shape, roll_off_factor between 0 and 1, filter_length even.
vec cos(const vec &x)
Cosine function.
Templated Vector Class Definitions.
(Square) Root Raised Cosine (RRC) Pulse Shaper