SigPack - the C++ signal processing library
Spectrum

Functions

template<class T1 >
arma::cx_vec sp::spectrum (const arma::Col< T1 > &x, const arma::vec &W)
 
template<class T1 >
arma::vec sp::psd (const arma::Col< T1 > &x, const arma::vec &W)
 
template<class T1 >
arma::vec sp::psd (const arma::Col< T1 > &x)
 
template<class T1 >
arma::cx_mat sp::specgram_cx (const arma::Col< T1 > &x, const arma::uword Nfft=512, const arma::uword Noverl=256)
 
template<class T1 >
arma::mat sp::specgram (const arma::Col< T1 > &x, const arma::uword Nfft=512, const arma::uword Noverl=256)
 
template<class T1 >
arma::mat sp::specgram_ph (const arma::Col< T1 > &x, const arma::uword Nfft=512, const arma::uword Noverl=256)
 
template<class T1 >
arma::vec sp::pwelch_ph (const arma::Col< T1 > &x, const arma::uword Nfft=512, const arma::uword Noverl=256)
 
template<class T1 >
arma::vec sp::pwelch (const arma::Col< T1 > &x, const arma::uword Nfft=512, const arma::uword Noverl=256)
 
template<class T1 >
std::complex< double > sp::goertzel (const arma::Col< T1 > &x, const double f)
 
template<class T1 >
arma::cx_vec sp::goertzel (const arma::Col< T1 > &x, const arma::vec f)
 

Detailed Description

Function Documentation

◆ goertzel() [1/2]

template<class T1 >
std::complex<double> sp::goertzel ( const arma::Col< T1 > &  x,
const double  f 
)

DFT calculation of a single frequency using Goertzel's method.

For more details see Sysel and Rajmic

Returns
The DFT of frequency f
Parameters
xInput vector
fFrequency index

Definition at line 193 of file spectrum.h.

References sp::PI_2.

Referenced by sp::goertzel().

◆ goertzel() [2/2]

template<class T1 >
arma::cx_vec sp::goertzel ( const arma::Col< T1 > &  x,
const arma::vec  f 
)

DFT calculation of a vector of frequencies using Goertzel's method.

For more details see Sysel and Rajmic

Returns
The DFT of frequency f
Parameters
xInput vector
fFrequency index vector

Definition at line 233 of file spectrum.h.

References sp::goertzel().

Here is the call graph for this function:

◆ psd() [1/2]

template<class T1 >
arma::vec sp::psd ( const arma::Col< T1 > &  x,
const arma::vec &  W 
)

Power spectrum density calculation using windowed data.

Returns
A real valued PSD vector
Parameters
xInput vector
WWindow function vector. NB! Must be same size as input vector

Definition at line 37 of file spectrum.h.

References sp::spectrum().

Referenced by sp::psd().

Here is the call graph for this function:

◆ psd() [2/2]

template<class T1 >
arma::vec sp::psd ( const arma::Col< T1 > &  x)

Power spectrum density calculation using Hamming windowed data.

Returns
A real valued PSD vector
Parameters
xInput vector

Definition at line 51 of file spectrum.h.

References sp::hamming(), and sp::psd().

Here is the call graph for this function:

◆ pwelch()

template<class T1 >
arma::vec sp::pwelch ( const arma::Col< T1 > &  x,
const arma::uword  Nfft = 512,
const arma::uword  Noverl = 256 
)

Power spectrum calculation using Welch's method.

abs(pwelch(x,Nfft,Noverl)) is equivalent to Matlab's: pwelch(x,Nfft,Noverl,'twosided','power')
See Welch's method at Wikipedia

Returns
A power spectrum vector
Parameters
xInput vector
NfftFFT size
NoverlFFT overlap size

Definition at line 175 of file spectrum.h.

References sp::specgram().

Here is the call graph for this function:

◆ pwelch_ph()

template<class T1 >
arma::vec sp::pwelch_ph ( const arma::Col< T1 > &  x,
const arma::uword  Nfft = 512,
const arma::uword  Noverl = 256 
)

Phase spectrum calculation using Welch's method.

See Welch's method at Wikipedia

Returns
A phase spectrum vector
Parameters
xInput vector
NfftFFT size
NoverlFFT overlap size

Definition at line 155 of file spectrum.h.

References sp::specgram_ph().

Here is the call graph for this function:

◆ specgram()

template<class T1 >
arma::mat sp::specgram ( const arma::Col< T1 > &  x,
const arma::uword  Nfft = 512,
const arma::uword  Noverl = 256 
)

Power spectrogram calculation.

See spectrogram at Wikipedia

Returns
A power spectrogram matrix
Parameters
xInput vector
NfftFFT size
NoverlFFT overlap size
Examples:
spectrum.cpp.

Definition at line 114 of file spectrum.h.

References sp::specgram_cx().

Referenced by main(), and sp::pwelch().

Here is the call graph for this function:

◆ specgram_cx()

template<class T1 >
arma::cx_mat sp::specgram_cx ( const arma::Col< T1 > &  x,
const arma::uword  Nfft = 512,
const arma::uword  Noverl = 256 
)

Spectrogram calculation using Hamming windowed data.

See spectrogram at Wikipedia

Returns
A complex spectrogram matrix
Parameters
xInput vector
NfftFFT size
NoverlFFT overlap size

Definition at line 68 of file spectrum.h.

References sp::hamming(), and sp::spectrum().

Referenced by sp::specgram(), and sp::specgram_ph().

Here is the call graph for this function:

◆ specgram_ph()

template<class T1 >
arma::mat sp::specgram_ph ( const arma::Col< T1 > &  x,
const arma::uword  Nfft = 512,
const arma::uword  Noverl = 256 
)

Phase spectrogram calculation.

See spectrogram at Wikipedia

Returns
A phase spectrogram matrix
Parameters
xInput vector
NfftFFT size
NoverlFFT overlap size

Definition at line 134 of file spectrum.h.

References sp::angle(), and sp::specgram_cx().

Referenced by sp::pwelch_ph().

Here is the call graph for this function:

◆ spectrum()

template<class T1 >
arma::cx_vec sp::spectrum ( const arma::Col< T1 > &  x,
const arma::vec &  W 
)

Windowed spectrum calculation.

The spectrum is calculated using the fast fourier transform of the windowed input data vector

Returns
A complex spectrum vector
Parameters
xInput vector
WWindow function vector. NB! Must be same size as input vector

Definition at line 23 of file spectrum.h.

Referenced by sp::psd(), and sp::specgram_cx().