50 for (
int i = 0;
i < r.
size();
i++) {
52 r(
i) = std::complex<double>(1.0) /
conj(r(
i));
62 for (
int i = 0;
i < r.
size();
i++) {
64 r(
i) = std::complex<double>(1.0) /
conj(r(
i));
71void freqz(
const cvec &b,
const cvec &
a,
const int N, cvec &
h, vec &w)
85cvec
freqz(
const cvec &b,
const cvec &
a,
const int N)
96cvec
freqz(
const cvec &b,
const cvec &
a,
const vec &w)
111void freqz(
const vec &b,
const vec &
a,
const int N, cvec &
h, vec &w)
125cvec
freqz(
const vec &b,
const vec &
a,
const int N)
136cvec
freqz(
const vec &b,
const vec &
a,
const vec &w)
155 it_assert(f.size() == m.size(),
"filter_design_autocorrelation: size of f and m vectors does not agree");
158 it_assert(f(0) == 0.0,
"filter_design_autocorrelation: first frequency must be 0.0");
159 it_assert(f(
N_f - 1) == 1.0,
"filter_design_autocorrelation: last frequency must be 1.0");
172 for (
int i = 0;
i <
N_f - 1;
i++) {
199 it_assert(m > 0,
"modified_yule_walker: m must be > 0");
200 it_assert(n > 0,
"modified_yule_walker: n must be > 0");
201 it_assert(N <= R.
size(),
"modified_yule_walker: autocorrelation function too short");
214 vec
rh = - R(m + 1, m + M);
230 it_assert(m > 0,
"arma_estimator: m must be > 0");
231 it_assert(n > 0,
"arma_estimator: n must be > 0");
232 it_assert(2*(m + n) <= R.size(),
"arma_estimator: autocorrelation function too short");
269void yulewalk(
const int N,
const vec &f,
const vec &m, vec &b, vec &
a)
271 it_assert(f.size() == m.size(),
"yulewalk: size of f and m vectors does not agree");
274 it_assert(f(0) == 0.0,
"yulewalk: first frequency must be 0.0");
275 it_assert(f(
N_f - 1) == 1.0,
"yulewalk: last frequency must be 1.0");
int size() const
Returns the number of data elements in the array object.
Definitions of converters between different vector and matrix types.
Elementary mathematical functions - header file.
Definitions of Filter classes and functions.
#define it_assert(t, s)
Abort if t is not true.
ITPP_EXPORT void ifft(const cvec &in, cvec &out)
Inverse Fast Fourier Transform.
ITPP_EXPORT void fft_real(const vec &in, cvec &out)
Real Fast Fourier Transform.
ITPP_EXPORT void ifft_real(const cvec &in, vec &out)
Inverse Real Fast Fourier Transform.
ITPP_EXPORT void fft(const cvec &in, cvec &out)
Fast Fourier Transform.
void filter_design_autocorrelation(const int N, const vec &f, const vec &m, vec &R)
Calculate autocorrelation from the specified frequency-response (suitable for filter design)
void yulewalk(const int N, const vec &f, const vec &m, vec &b, vec &a)
ARMA filter design using a least-squares fit to the specified frequency-response.
void arma_estimator(const int m, const int n, const vec &R, vec &b, vec &a)
Estimation of ARMA model given the autocorrelation.
void modified_yule_walker(const int m, const int n, const int N, const vec &R, vec &a)
Estimation of AR-part in an ARMA model given the autocorrelation.
vec filter(const vec &b, const vec &a, const vec &input)
ARMA filter function.
void polystab(const vec &a, vec &out)
Polynomial Stabilization.
void freqz(const cvec &b, const cvec &a, const int N, cvec &h, vec &w)
Frequency response of filter.
bool backslash(const mat &A, const vec &b, vec &x)
A general linear equation system solver.
vec log(const vec &x)
The natural logarithm of the elements.
vec exp(const vec &x)
Exp of the elements of a vector x.
Vec< T > zero_pad(const Vec< T > &v, int n)
Zero-pad a vector to size n.
vec real(const cvec &data)
Real part of complex values.
vec sqr(const cvec &data)
Absolute square of elements.
cvec conj(const cvec &x)
Conjugate of complex value.
vec polyval(const vec &p, const vec &x)
Evaluate polynomial.
void poly(const vec &r, vec &p)
Create a polynomial of the given roots.
void roots(const vec &p, cvec &r)
Calculate the roots of the polynomial.
Vec< T > reverse(const Vec< T > &in)
Reverse the input vector.
vec linspace(double from, double to, int points)
linspace (works in the same way as the MATLAB version)
ITPP_EXPORT vec zeros(int size)
A Double vector of zeros.
const cmat toeplitz(const cvec &c)
Generate symmetric Toeplitz matrix from vector c (complex valued)
ITPP_EXPORT cvec zeros_c(int size)
A Double Complex vector of zeros.
vec sin(const vec &x)
Sine function.
vec cos(const vec &x)
Cosine function.
Definitions of functions for solving linear equation systems.
Various functions on vectors and matrices - header file.
cvec to_cvec(const Vec< T > &v)
Converts a Vec<T> to cvec.
cmat to_cmat(const Mat< T > &m)
Converts a Mat<T> to cmat.
const Array< T > concat(const Array< T > &a, const T &e)
Append element e to the end of the Array a.
const double pi
Constant Pi.
Mat< Num_T > elem_div(const Mat< Num_T > &m1, const Mat< Num_T > &m2)
Element wise division of two matrices.
int floor_i(double x)
The nearest smaller integer.
Mat< Num_T > elem_mult(const Mat< Num_T > &m1, const Mat< Num_T > &m2)
Element wise multiplication of two matrices.
bin abs(const bin &inbin)
absolute value of bin
Definitions of special vectors and matrices.
Trigonometric and hyperbolic functions - header file.