IT++ Logo
Functions
Miscellaneous SP Functions
Signal Processing (SP) Module

Functions

cvec itpp::xcorr (const cvec &x, const cvec &y, const int max_lag=-1, const std::string scaleopt="none")
 Cross Correlation.
 
cvec itpp::xcorr (const cvec &x, const int max_lag=-1, const std::string scaleopt="none")
 Cross Correlation.
 
void itpp::xcorr (const cvec &x, const cvec &y, cvec &out, const int max_lag=-1, const std::string scaleopt="none", bool autoflag=true)
 Cross Correlation.
 
mat itpp::cov (const mat &X, bool is_zero_mean=false)
 Covariance matrix calculation.
 
vec itpp::spectrum (const vec &v, int nfft=256, int noverlap=0)
 Power spectrum calculation.
 
vec itpp::spectrum (const vec &v, const vec &w, int noverlap=0)
 Power spectrum calculation.
 
vec itpp::filter_spectrum (const vec &a, int nfft=256)
 Power spectrum calculation of a filter.
 
vec itpp::filter_spectrum (const vec &a, const vec &b, int nfft=256)
 Power spectrum calculation of a filter.
 
void itpp::xcorr_old (const vec &x, const vec &y, vec &out, const int max_lag=-1, const std::string scaleopt="none")
 Cross-correlation calculation.
 
void itpp::xcorr (const vec &x, const vec &y, vec &out, const int max_lag, const std::string scaleopt)
 Cross-correlation calculation.
 
vec itpp::xcorr_old (const vec &x, const vec &y, const int max_lag=-1, const std::string scaleopt="none")
 Cross-correlation calculation.
 
vec itpp::xcorr (const vec &x, const vec &y, const int max_lag, const std::string scaleopt)
 Cross-correlation calculation.
 
vec itpp::xcorr_old (const vec &x, const int max_lag=-1, const std::string scaleopt="none")
 Auto-correlation calculation.
 
vec itpp::xcorr (const vec &x, const int max_lag, const std::string scaleopt)
 Auto-correlation calculation.
 

Detailed Description

Function Documentation

ITPP_EXPORT void itpp::xcorr_old ( const vec &  x,
const vec &  y,
vec &  out,
const int  max_lag = -1,
const std::string  scaleopt = "none" 
)

Cross-correlation calculation.

z=xcorr(x,y,max_lag), where x and y are length M vectors (M>1), returns the length 2*max_lag+1 cross-correlation sequence z. (lags: -max_lag,...,0,...,max_lag)

For max_lag=-1 the cross-correlation sequence is of length 2*M-1, i.e., the cross-correlation for all possible lags.

Scaling options scaleopt:

  • none => No scaling of the cross-correlation vector
  • biased => Scales the cross-correlation vector by 1/M
  • unbiased => Scales the cross-correlation vector by 1/(M-abs(lag))
  • coeff => Normalises the cross-correlation to 1 for zero lag.
Note
max_lag <= M-1
If x and y are of different length, the shortest one is zero-padded
Parameters
x(Input) Vector of samples
y(Input) Vector of samples
out(Output) The cross correlation between x and y.
max_lag(Input) Maximum lag for which the cross-correlation is calculated. The output vector is of size 2*maxlag+1. Default value: max_lag=-1 calculates the cross-correlations for all possible lags
scaleopt(Input) Indicates how the cross-correlation function should be scaled. Default value: "none" indicates that no scaling is done

Definition at line 92 of file sigfun.cpp.

References itpp::energy(), itpp::index_zero_pad(), it_assert, it_error, itpp::max(), and itpp::sqrt().

ITPP_EXPORT void itpp::xcorr ( const vec &  x,
const vec &  y,
vec &  out,
const int  max_lag,
const std::string  scaleopt 
)

Cross-correlation calculation.

z=xcorr(x,y,max_lag), where x and y are length M vectors (M>1), returns the length 2*max_lag+1 cross-correlation sequence z. (lags: -max_lag,...,0,...,max_lag)

For max_lag=-1 the cross-correlation sequence is of length 2*M-1, i.e., the cross-correlation for all possible lags.

Scaling options scaleopt:

  • none => No scaling of the cross-correlation vector
  • biased => Scales the cross-correlation vector by 1/M
  • unbiased => Scales the cross-correlation vector by 1/(M-abs(lag))
  • coeff => Normalises the cross-correlation to 1 for zero lag.
Note
max_lag <= M-1
If x and y are of different length, the shortest one is zero-padded
Parameters
x(Input) Vector of samples
y(Input) Vector of samples
out(Output) The cross correlation between x and y.
max_lag(Input) Maximum lag for which the cross-correlation is calculated. The output vector is of size 2*maxlag+1. Default value: max_lag=-1 calculates the cross-correlations for all possible lags
scaleopt(Input) Indicates how the cross-correlation function should be scaled. Default value: "none" indicates that no scaling is done

Definition at line 82 of file sigfun.cpp.

References itpp::real(), itpp::to_cvec(), and itpp::xcorr().

ITPP_EXPORT vec itpp::xcorr_old ( const vec &  x,
const vec &  y,
const int  max_lag = -1,
const std::string  scaleopt = "none" 
)

Cross-correlation calculation.

z=xcorr(x,y,max_lag), where x and y are length M vectors (M>1), returns the length 2*max_lag+1 cross-correlation sequence z. (lags: -max_lag,...,0,...,max_lag)

For max_lag=-1 the cross-correlation sequence is of length 2*M-1, i.e., the cross-correlation for all possible lags.

Scaling options scaleopt:

  • none => No scaling of the cross-correlation vector
  • biased => Scales the cross-correlation vector by 1/M
  • unbiased => Scales the cross-correlation vector by 1/(M-abs(lag))
  • coeff => Normalises the cross-correlation to 1 for zero lag.
Note
max_lag <= M-1
If x and y are of different length, the shortest one is zero-padded
Parameters
x(Input) Vector of samples
y(Input) Vector of samples
max_lag(Input) Maximum lag for which the cross-correlation is calculated. The output vector is of size 2*maxlag+1. Default value: max_lag=-1 calculates the cross-correlations for all possible lags
scaleopt(Input) Indicates how the cross-correlation function should be scaled. Default value: "none" indicates that no scaling is done
Returns
The cross correlation between x and y.

Definition at line 148 of file sigfun.cpp.

References itpp::xcorr_old().

ITPP_EXPORT vec itpp::xcorr ( const vec &  x,
const vec &  y,
const int  max_lag,
const std::string  scaleopt 
)

Cross-correlation calculation.

z=xcorr(x,y,max_lag), where x and y are length M vectors (M>1), returns the length 2*max_lag+1 cross-correlation sequence z. (lags: -max_lag,...,0,...,max_lag)

For max_lag=-1 the cross-correlation sequence is of length 2*M-1, i.e., the cross-correlation for all possible lags.

Scaling options scaleopt:

  • none => No scaling of the cross-correlation vector
  • biased => Scales the cross-correlation vector by 1/M
  • unbiased => Scales the cross-correlation vector by 1/(M-abs(lag))
  • coeff => Normalises the cross-correlation to 1 for zero lag.
Note
max_lag <= M-1
If x and y are of different length, the shortest one is zero-padded
Parameters
x(Input) Vector of samples
y(Input) Vector of samples
max_lag(Input) Maximum lag for which the cross-correlation is calculated. The output vector is of size 2*maxlag+1. Default value: max_lag=-1 calculates the cross-correlations for all possible lags
scaleopt(Input) Indicates how the cross-correlation function should be scaled. Default value: "none" indicates that no scaling is done
Returns
The cross correlation between x and y.

Definition at line 66 of file sigfun.cpp.

References itpp::real(), itpp::to_cvec(), and itpp::xcorr().

ITPP_EXPORT cvec itpp::xcorr ( const cvec &  x,
const cvec &  y,
const int  max_lag = -1,
const std::string  scaleopt = "none" 
)

Cross Correlation.

r = xcorr(x,y)

returns the cross-correlation vector r.

Definition at line 74 of file sigfun.cpp.

References itpp::xcorr().

ITPP_EXPORT vec itpp::xcorr_old ( const vec &  x,
const int  max_lag = -1,
const std::string  scaleopt = "none" 
)

Auto-correlation calculation.

z=xcorr(x,max_lag), where x and is a length M vector (M>1), returns the length 2*max_lag+1 auto-correlation sequence z. (lags: -max_lag,...,0,...,max_lag)

For max_lag=-1 the auto-correlation sequence is of length 2*M-1, i.e., the cross correlation for all possible lags.

Scaling options scaleopt:

  • none => No scaling of the auto-correlation vector
  • biased => Scales the auto-correlation vector by 1/M
  • unbiased => Scales the auto-correlation vector by 1/(M-abs(lag))
  • coeff => Normalises the auto-correlation so that acf(x)=1 for zero lag.
Note
max_lag <= M-1
Parameters
x(Input) Vector of samples
max_lag(Input) Maximum lag for which the auto-correlation is calculated. The output vector is of size 2*maxlag+1. Default value max_lag=-1 calculates the auto-correlations for all possible lags.
scaleopt(Input) Indicates how the auto-correlation function should be scaled. Default value: "none" indicates that no scaling is done.
Returns
The auto-correlation of x.

Definition at line 43 of file sigfun.cpp.

Referenced by itpp::xcorr_old().

ITPP_EXPORT vec itpp::xcorr ( const vec &  x,
const int  max_lag,
const std::string  scaleopt 
)

Auto-correlation calculation.

z=xcorr(x,max_lag), where x and is a length M vector (M>1), returns the length 2*max_lag+1 auto-correlation sequence z. (lags: -max_lag,...,0,...,max_lag)

For max_lag=-1 the auto-correlation sequence is of length 2*M-1, i.e., the cross correlation for all possible lags.

Scaling options scaleopt:

  • none => No scaling of the auto-correlation vector
  • biased => Scales the auto-correlation vector by 1/M
  • unbiased => Scales the auto-correlation vector by 1/(M-abs(lag))
  • coeff => Normalises the auto-correlation so that acf(x)=1 for zero lag.
Note
max_lag <= M-1
Parameters
x(Input) Vector of samples
max_lag(Input) Maximum lag for which the auto-correlation is calculated. The output vector is of size 2*maxlag+1. Default value max_lag=-1 calculates the auto-correlations for all possible lags.
scaleopt(Input) Indicates how the auto-correlation function should be scaled. Default value: "none" indicates that no scaling is done.
Returns
The auto-correlation of x.

Definition at line 50 of file sigfun.cpp.

References itpp::real(), and itpp::to_cvec().

Referenced by itpp::xcorr().

ITPP_EXPORT cvec itpp::xcorr ( const cvec &  x,
const int  max_lag = -1,
const std::string  scaleopt = "none" 
)

Cross Correlation.

r = xcorr(x)

returns the auto-correlation vecotr r.

Definition at line 58 of file sigfun.cpp.

References itpp::xcorr().

ITPP_EXPORT void itpp::xcorr ( const cvec &  x,
const cvec &  y,
cvec &  out,
const int  max_lag = -1,
const std::string  scaleopt = "none",
bool  autoflag = true 
)

Cross Correlation.

xcorr(x,y,out)

Computes the cross-correlatin and returns in vector out

Definition at line 156 of file sigfun.cpp.

References itpp::abs(), itpp::ceil_i(), itpp::concat(), itpp::conj(), itpp::elem_mult(), itpp::fft(), itpp::ifft(), it_warning, itpp::linspace(), itpp::log2(), itpp::max(), itpp::pow2i(), itpp::sqrt(), itpp::sum(), itpp::to_cvec(), and itpp::zero_pad().

ITPP_EXPORT mat itpp::cov ( const mat &  X,
bool  is_zero_mean = false 
)

Covariance matrix calculation.

Calculates the covariance matrix of the observations in the matrix $X$. Each row is an observation and each column represents a variable.

The covariance is normalized with the number of observations $N$. The mean value is removed before calculation.

Set is_zero_mean if X already has zero mean.

Definition at line 226 of file sigfun.cpp.

References itpp::mean().

Referenced by pcamat().

ITPP_EXPORT vec itpp::spectrum ( const vec &  v,
int  nfft = 256,
int  noverlap = 0 
)
ITPP_EXPORT vec itpp::spectrum ( const vec &  v,
const vec &  w,
int  noverlap = 0 
)

Power spectrum calculation.

Calculates the power spectrum using using the Welch method and the supplied window w.

Definition at line 296 of file sigfun.cpp.

References itpp::abs(), itpp::elem_mult(), itpp::energy(), itpp::fft(), it_assert_debug, itpp::levels2bits(), itpp::pow2i(), itpp::sqr(), itpp::to_cvec(), and itpp::zero_pad().

ITPP_EXPORT vec itpp::filter_spectrum ( const vec &  a,
int  nfft = 256 
)

Power spectrum calculation of a filter.

Calculates the power spectrum of a filter with transfer function a(z)

Definition at line 325 of file sigfun.cpp.

References itpp::abs(), itpp::fft(), itpp::sqr(), and itpp::to_cvec().

ITPP_EXPORT vec itpp::filter_spectrum ( const vec &  a,
const vec &  b,
int  nfft = 256 
)

Power spectrum calculation of a filter.

Calculates the power spectrum of a filter with transfer function a(z)/b(z)

Definition at line 332 of file sigfun.cpp.

References itpp::abs(), itpp::elem_div(), itpp::fft(), itpp::sqr(), and itpp::to_cvec().

SourceForge Logo

Generated on Sat May 25 2013 16:32:27 for IT++ by Doxygen 1.8.2